logo       

Re: [Gaim-commits] CVS: gaim/src prefs.c,1.442,1.443 pounce.c,1.35,1.36 acc: msg#00166

gnome.gaim.devel

Subject: Re: [Gaim-commits] CVS: gaim/src prefs.c,1.442,1.443 pounce.c,1.35,1.36 account.c,1.110,1.111 blist.c,1.186,1.187

On 2004-12-19 17:36:03 UTC, Stu Tomlinson wrote:
> Modified Files:
> 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.

These hacks will only work in the case of total filling of disk space
(not partial filling)

If you really want a solution you have to check every operation (fopen,
fwrite, fclose, ... everything) and if anything fails not commit.

Eduardo

> Index: prefs.c
> ===================================================================
> RCS file: /cvsroot/gaim/gaim/src/prefs.c,v
> retrieving revision 1.442
> retrieving revision 1.443
> diff -u -d -p -r1.442 -r1.443
> --- prefs.c 16 Dec 2004 05:34:34 -0000 1.442
> +++ prefs.c 19 Dec 2004 17:35:59 -0000 1.443
> @@ -830,6 +831,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.36
> diff -u -d -p -r1.35 -r1.36
> --- pounce.c 26 Jul 2004 04:05:08 -0000 1.35
> +++ pounce.c 19 Dec 2004 17:35:59 -0000 1.36
> @@ -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.110
> retrieving revision 1.111
> diff -u -d -p -r1.110 -r1.111
> --- account.c 15 Dec 2004 22:25:54 -0000 1.110
> +++ account.c 19 Dec 2004 17:35:59 -0000 1.111
> @@ -1527,6 +1528,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.186
> retrieving revision 1.187
> diff -u -d -p -r1.186 -r1.187
> --- blist.c 16 Dec 2004 05:34:33 -0000 1.186
> +++ blist.c 19 Dec 2004 17:35:59 -0000 1.187
> @@ -2416,13 +2417,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);
> }
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise