changeset 5250:649e54d617da

[gaim-migrate @ 5622] If your partition was full when saving preferences, .gaimrc.save could get created or half created, and then that file would get renamed to .gaimrc, which is bad, because the new rc file would be corrupt or whatever. So I just added an ugly little check for "if I can add a newline on to the end of ~/.gaimrc.save, then it probably got written ok." I'm not really a big fan of .gaimrc. Someone with some skills might want to rewrite it? Or maybe we should use xml or something? I dunno. Hooverphonic is cool committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 28 Apr 2003 06:49:07 +0000
parents 98fc2d44c2ba
children d11cb52d5309
files src/gaimrc.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaimrc.c	Mon Apr 28 06:23:42 2003 +0000
+++ b/src/gaimrc.c	Mon Apr 28 06:49:07 2003 +0000
@@ -1586,10 +1586,14 @@
 			gaimrc_write_plugins(f);
 
 		gaimrc_write_proxy(f);
+		if (fprintf(f, "\n") == 1) {
+			if (rename(filename_temp, filename) < 0)
+				gaim_debug(GAIM_DEBUG_ERROR, "gaimrc", 
+					   "Error renaming %s to %s\n", filename_temp, filename);
+		} else
+			gaim_debug(GAIM_DEBUG_ERROR, "gaimrc",
+				   "Unable to create new .gaimrc file.  Preferences not updated.");
 		fclose(f);
-		if (rename(filename_temp, filename) < 0)
-			gaim_debug(GAIM_DEBUG_ERROR, "gaimrc",
-					   "Error renaming %s to %s\n", filename_temp, filename);
 		is_saving_prefs = 0;
 	} else
 		gaim_debug(GAIM_DEBUG_ERROR, "gaimrc",