Mercurial > pidgin
comparison src/util.c @ 13585:ffb12e85473f
[gaim-migrate @ 15970]
gaim_util_write_data_to_file() should not be unlink()ing the target before rename()ing the temporary file over top of the target. rename() will remove the target, if it exists.
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Wed, 05 Apr 2006 02:10:39 +0000 |
| parents | 097ae11c67e0 |
| children | 723fd573111c |
comparison
equal
deleted
inserted
replaced
| 13584:097ae11c67e0 | 13585:ffb12e85473f |
|---|---|
| 2378 gaim_debug_error("util", "Error setting permissions of file %s: %s\n", | 2378 gaim_debug_error("util", "Error setting permissions of file %s: %s\n", |
| 2379 filename_temp, strerror(errno)); | 2379 filename_temp, strerror(errno)); |
| 2380 } | 2380 } |
| 2381 #endif | 2381 #endif |
| 2382 | 2382 |
| 2383 /* Remove the old file, if it exists */ | |
| 2384 if (g_file_test(filename_full, G_FILE_TEST_EXISTS)) | |
| 2385 { | |
| 2386 if (g_unlink(filename_full) == -1) | |
| 2387 { | |
| 2388 gaim_debug_error("util", "Error removing old file %s: %s\n", | |
| 2389 filename_full, strerror(errno)); | |
| 2390 } | |
| 2391 } | |
| 2392 | |
| 2393 /* Rename to the REAL name */ | 2383 /* Rename to the REAL name */ |
| 2394 if (g_rename(filename_temp, filename_full) == -1) | 2384 if (g_rename(filename_temp, filename_full) == -1) |
| 2395 { | 2385 { |
| 2396 gaim_debug_error("util", "Error renaming %s to %s: %s\n", | 2386 gaim_debug_error("util", "Error renaming %s to %s: %s\n", |
| 2397 filename_temp, filename_full, strerror(errno)); | 2387 filename_temp, filename_full, strerror(errno)); |
