comparison src/account.c @ 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 b234ad7e0dfe
children 6a043ae92db6
comparison
equal deleted inserted replaced
10398:de59c0e7f87e 10399:aab0c9508318
1479 1479
1480 void 1480 void
1481 gaim_accounts_sync(void) 1481 gaim_accounts_sync(void)
1482 { 1482 {
1483 FILE *fp; 1483 FILE *fp;
1484 struct stat st;
1484 const char *user_dir = gaim_user_dir(); 1485 const char *user_dir = gaim_user_dir();
1485 char *filename; 1486 char *filename;
1486 char *filename_real; 1487 char *filename_real;
1487 1488
1488 if (!accounts_loaded) { 1489 if (!accounts_loaded) {
1521 chmod(filename, S_IRUSR | S_IWUSR); 1522 chmod(filename, S_IRUSR | S_IWUSR);
1522 } 1523 }
1523 else { 1524 else {
1524 gaim_debug_error("accounts", "Unable to write %s\n", 1525 gaim_debug_error("accounts", "Unable to write %s\n",
1525 filename); 1526 filename);
1527 g_free(filename);
1528 return;
1529 }
1530
1531 if (stat(filename, &st) || (st.st_size == 0)) {
1532 gaim_debug_error("accounts", "Failed to save accounts\n");
1533 unlink(filename);
1526 g_free(filename); 1534 g_free(filename);
1527 return; 1535 return;
1528 } 1536 }
1529 1537
1530 filename_real = g_build_filename(user_dir, "accounts.xml", NULL); 1538 filename_real = g_build_filename(user_dir, "accounts.xml", NULL);