englebass pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=e7198621c585af10e03a467befd05a3eaf5b5e51

commit e7198621c585af10e03a467befd05a3eaf5b5e51
Author: Sebastian Dransfeld <s...@tango.flipp.net>
Date:   Thu Aug 14 13:29:24 2014 +0200

    efreet: use eina_file_mkstemp to create filename
---
 src/lib/efreet/efreet_desktop_command.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/lib/efreet/efreet_desktop_command.c 
b/src/lib/efreet/efreet_desktop_command.c
index 1e4c51d..bed40dc 100644
--- a/src/lib/efreet/efreet_desktop_command.c
+++ b/src/lib/efreet/efreet_desktop_command.c
@@ -74,8 +74,6 @@ struct Efreet_Desktop_Command_File
   int pending;
 };
 
-static int efreet_desktop_command_file_id = 0;
-
 static void *efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop,
                                             char *exec, int remaining);
 static int efreet_desktop_command_flags_get(Efreet_Desktop *desktop);
@@ -647,14 +645,21 @@ 
efreet_desktop_command_file_process(Efreet_Desktop_Command *command, const char
         if (command->flags & EFREET_DESKTOP_EXEC_FLAG_FULLPATH)
         {
             char buf[PATH_MAX];
+            Eina_Tmpstr *dest;
+            int fd;
 
-            snprintf(buf, sizeof(buf), "/tmp/%d-%d-%s", getpid(),
-                            efreet_desktop_command_file_id++, base);
-            f->fullpath = strdup(buf);
-            f->pending = 1;
+            snprintf(buf, sizeof(buf), "%s_XXXXXX", base);
+            fd = eina_file_mkstemp(buf, &dest);
+            if (fd >= 0)
+            {
+                close(fd);
+                f->fullpath = strdup(dest);
+                f->pending = 1;
+                eina_tmpstr_del(dest);
 
-            ecore_file_download(uri, f->fullpath, 
efreet_desktop_cb_download_complete,
-                                            
efreet_desktop_cb_download_progress, f, NULL);
+                ecore_file_download(uri, f->fullpath, 
efreet_desktop_cb_download_complete,
+                                    efreet_desktop_cb_download_progress, f, 
NULL);
+            }
         }
 
         if (command->flags & EFREET_DESKTOP_EXEC_FLAG_URI)

-- 


Reply via email to