[tracker/writeback-refactor-rebase: 10/43] tracker-writeback: Use tempnam instead of home brewn system
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/writeback-refactor-rebase: 10/43] tracker-writeback: Use tempnam instead of home brewn system
- Date: Tue, 26 Jul 2011 09:31:42 +0000 (UTC)
commit 39229d4f861864d44758a1331ed4bbcb4da9bd51
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]