From: Stu T. <nos...@us...> - 2004-12-19 17:35:41
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6869 Modified Files: Tag: oldstatus prefs.c pounce.c account.c blist.c Log Message: 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. Index: prefs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/prefs.c,v retrieving revision 1.437 retrieving revision 1.437.2.1 diff -u -d -p -r1.437 -r1.437.2.1 --- prefs.c 25 Jul 2004 22:13:03 -0000 1.437 +++ prefs.c 19 Dec 2004 17:35:29 -0000 1.437.2.1 @@ -768,6 +768,7 @@ static void gaim_prefs_write(FILE *f, st void gaim_prefs_sync() { FILE *file; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -802,6 +803,13 @@ void gaim_prefs_sync() { 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", Index: pounce.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/pounce.c,v retrieving revision 1.35 retrieving revision 1.35.2.1 diff -u -d -p -r1.35 -r1.35.2.1 --- pounce.c 26 Jul 2004 04:05:08 -0000 1.35 +++ pounce.c 19 Dec 2004 17:35:30 -0000 1.35.2.1 @@ -846,6 +846,7 @@ void 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 @@ gaim_pounces_sync(void) 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) { Index: account.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/account.c,v retrieving revision 1.96.2.1 retrieving revision 1.96.2.2 diff -u -d -p -r1.96.2.1 -r1.96.2.2 --- account.c 17 Oct 2004 22:00:56 -0000 1.96.2.1 +++ account.c 19 Dec 2004 17:35:30 -0000 1.96.2.2 @@ -1362,6 +1362,7 @@ void gaim_accounts_sync(void) { FILE *fp; + struct stat st; const char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -1408,6 +1409,13 @@ gaim_accounts_sync(void) 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) { Index: blist.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/blist.c,v retrieving revision 1.169.2.1 retrieving revision 1.169.2.2 diff -u -d -p -r1.169.2.1 -r1.169.2.2 --- blist.c 16 Nov 2004 04:13:25 -0000 1.169.2.1 +++ blist.c 19 Dec 2004 17:35:30 -0000 1.169.2.2 @@ -2381,6 +2381,7 @@ static void gaim_blist_write(FILE *file, void gaim_blist_sync() { FILE *file; + struct stat st; char *user_dir = gaim_user_dir(); char *filename; char *filename_real; @@ -2413,13 +2414,19 @@ void gaim_blist_sync() 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); } |