[tracker] tracker-writeback: preserve original file if writeback fails
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-writeback: preserve original file if writeback fails
- Date: Fri, 29 Jul 2011 12:45:55 +0000 (UTC)
commit 76535bc895c6ce2a164f7957e2297ddcba7b5930
Author: Carlos Garnacho <carlos lanedo com>
Date: Fri Jul 29 14:41:18 2011 +0200
tracker-writeback: preserve original file if writeback fails
The temporary file is now deleted instead, leaving the original
file unmodified.
src/tracker-writeback/tracker-writeback-file.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index e08b11f..5092e18 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -203,10 +203,15 @@ tracker_writeback_file_update_metadata (TrackerWriteback *writeback,
connection,
cancellable);
- /* Move back the modified file to the original location */
- g_file_move (tmp_file, file,
- G_FILE_COPY_OVERWRITE,
- NULL, NULL, NULL, NULL);
+ if (!retval) {
+ /* Delete the temporary file and preserve original */
+ g_file_delete (tmp_file, NULL, NULL);
+ } else {
+ /* Move back the modified file to the original location */
+ g_file_move (tmp_file, file,
+ G_FILE_COPY_OVERWRITE,
+ NULL, NULL, NULL, NULL);
+ }
g_object_unref (tmp_file);
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]