Mercurial > pidgin.yaz
changeset 10399:aab0c9508318
[gaim-migrate @ 11630]
Don't erase prefs/accounts/blist/pounces if we failed to write the new file
to disk - this fixes the "Gaim lost all my settings when my disk/quota
filled up" bugs.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 19 Dec 2004 17:35:59 +0000 |
parents | de59c0e7f87e |
children | 6a043ae92db6 |
files | src/account.c src/blist.c src/pounce.c src/prefs.c |
diffstat | 4 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/account.c Sun Dec 19 12:57:29 2004 +0000 +++ b/src/account.c Sun Dec 19 17:35:59 2004 +0000 @@ -1481,6 +1481,7 @@ gaim_accounts_sync(void) { FILE *fp; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -1527,6 +1528,13 @@ return; } + if (stat(filename, &st) || (st.st_size == 0)) { + gaim_debug_error("accounts", "Failed to save accounts\n"); + unlink(filename); + g_free(filename); + return; + } + filename_real = g_build_filename(user_dir, "accounts.xml", NULL); if (rename(filename, filename_real) < 0) {
--- a/src/blist.c Sun Dec 19 12:57:29 2004 +0000 +++ b/src/blist.c Sun Dec 19 17:35:59 2004 +0000 @@ -2384,6 +2384,7 @@ void gaim_blist_sync() { FILE *file; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -2416,13 +2417,19 @@ return; } + if (stat(filename, &st) || (st.st_size == 0)) { + gaim_debug_error("blist", "Failed to save blist\n"); + unlink(filename); + g_free(filename); + return; + } + filename_real = g_build_filename(user_dir, "blist.xml", NULL); if (rename(filename, filename_real) < 0) gaim_debug(GAIM_DEBUG_ERROR, "blist save", "Error renaming %s to %s\n", filename, filename_real); - g_free(filename); g_free(filename_real); }
--- a/src/pounce.c Sun Dec 19 12:57:29 2004 +0000 +++ b/src/pounce.c Sun Dec 19 17:35:59 2004 +0000 @@ -846,6 +846,7 @@ gaim_pounces_sync(void) { FILE *fp; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -892,6 +893,13 @@ return; } + if (stat(filename, &st) || (st.st_size == 0)) { + gaim_debug_error("pounces", "Failed to save pounces\n"); + unlink(filename); + g_free(filename); + return; + } + filename_real = g_build_filename(user_dir, "pounces.xml", NULL); if (rename(filename, filename_real) < 0) {
--- a/src/prefs.c Sun Dec 19 12:57:29 2004 +0000 +++ b/src/prefs.c Sun Dec 19 17:35:59 2004 +0000 @@ -796,6 +796,7 @@ void gaim_prefs_sync() { FILE *file; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -830,6 +831,13 @@ return; } + if (stat(filename, &st) || (st.st_size == 0)) { + gaim_debug_error("prefs", "Failed to save prefs\n"); + unlink(filename); + g_free(filename); + return; + } + filename_real = g_build_filename(user_dir, "prefs.xml", NULL); if(rename(filename, filename_real) < 0) gaim_debug(GAIM_DEBUG_ERROR, "prefs", "Error renaming %s to %s\n",