[tracker/writeback-refactor-rebase: 10/17] tracker-writeback: Use tempnam instead of home brewn system



commit b91a8ba28bda4b2f3bc19b3812f702332564d539
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Jul 14 11:22:17 2011 +0200

    tracker-writeback: Use tempnam instead of home brewn system

 src/tracker-writeback/tracker-writeback-file.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-writeback/tracker-writeback-file.c b/src/tracker-writeback/tracker-writeback-file.c
index 60175b5..edfcc99 100644
--- a/src/tracker-writeback/tracker-writeback-file.c
+++ b/src/tracker-writeback/tracker-writeback-file.c
@@ -19,6 +19,8 @@
 
 #include "config.h"
 
+#include <stdio.h>
+
 #include <libtracker-common/tracker-file-utils.h>
 
 #include "tracker-writeback-file.h"
@@ -63,19 +65,20 @@ static GFile *
 get_tmp_file (GFile *file)
 {
 	GFile *tmp_file, *parent;
-	gchar *tmp_name, *name;
+	gchar *tmp_name, *dir;
 
 	/* Create a temporary, hidden file
 	 * within the same directory */
 	parent = g_file_get_parent (file);
-	name = g_file_get_basename (file);
-
-	tmp_name = g_strdup_printf ("._tracker_%s", name);
-	tmp_file = g_file_get_child (parent, tmp_name);
+	dir = g_file_get_path (parent);
 
+	tmp_name = tempnam (dir, "._trk");
 	g_object_unref (parent);
+
+	tmp_file = g_file_new_for_path (tmp_name);
+
 	g_free (tmp_name);
-	g_free (name);
+	g_free (dir);
 
 	return tmp_file;
 }



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