changeset 4891:cfa045006bec

[gaim-migrate @ 5221] this saves the blist.xml file to an alternate name, and then moves it, that way we don't lose your precious buddies if gaim crashes. Of course, if gaim were to crash, it wouldn't be gaim's fault, it would be the fault of some external force. This is because gaim is perfect, and Sean is perfect. Yeah. This should be done for .gaimrc too, but i'm too tired to do that right now. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 25 Mar 2003 06:35:45 +0000
parents 89cb14edf8cf
children dc6de8ad81ae
files src/list.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/list.c	Tue Mar 25 06:26:24 2003 +0000
+++ b/src/list.c	Tue Mar 25 06:35:45 2003 +0000
@@ -1211,6 +1211,7 @@
 	FILE *file;
 	char *user_dir = gaim_user_dir();
 	char *filename;
+	char *filename_real;
 
 	if(!user_dir)
 		return;
@@ -1225,7 +1226,7 @@
 	else
 		fclose(file);
 
-	filename = g_build_filename(user_dir, "blist.xml", NULL);
+	filename = g_build_filename(user_dir, "blist.xml.save", NULL);
 
 	if((file = fopen(filename, "w"))) {
 		gaim_blist_write(file, NULL);
@@ -1235,7 +1236,14 @@
 		debug_printf("unable to write %s\n", filename);
 	}
 
+	filename_real = g_build_filename(user_dir, "blist.xml", NULL);
+
+	if(rename(filename, filename_real) < 0)
+		debug_printf("error renaming %s to %s\n", filename, filename_real);
+
+
 	g_free(filename);
+	g_free(filename_real);
 }
 
 gboolean gaim_privacy_permit_add(struct gaim_account *account, const char *who) {