[tracker/writeback-refactor-0.10] tracker-writeback: preserve original file if writeback fails
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/writeback-refactor-0.10] tracker-writeback: preserve original file if writeback fails
- Date: Fri, 29 Jul 2011 12:46:48 +0000 (UTC)
commit 9f6702b9a26d62b9e27091d96fafd0b384258442
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 cc6ee16..932253d 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -202,10 +202,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_info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]