[tracker] tracker-db-manager: g_open may return -1



commit 6a13da71c70b4653c9a8804f097a34ef83bf8f24
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 4 15:41:05 2010 +0200

    tracker-db-manager: g_open may return -1

 src/libtracker-db/tracker-db-manager.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-db/tracker-db-manager.c b/src/libtracker-db/tracker-db-manager.c
index bc8eb01..51aa979 100644
--- a/src/libtracker-db/tracker-db-manager.c
+++ b/src/libtracker-db/tracker-db-manager.c
@@ -889,8 +889,12 @@ tracker_db_manager_init (TrackerDBManagerFlags  flags,
 	in_use_file = g_open (in_use_filename,
 	                      O_WRONLY | O_APPEND | O_CREAT | O_SYNC,
 	                      S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-	fsync (in_use_file);
-	close (in_use_file);
+
+        if (in_use_file >= 0) {
+                fsync (in_use_file);
+                close (in_use_file);
+        }
+
 	g_free (in_use_filename);
 
 	tracker_db_manager_ensure_locale ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]