[tracker/tracker-0.10] tracker-writeback: Use tempnam instead of home brewn system
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-writeback: Use tempnam instead of home brewn system
- Date: Mon, 1 Aug 2011 16:16:33 +0000 (UTC)
commit dbe125d8e17302378b5d480de71bfa7b160b8030
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]