diff options
author | Sebastian Dransfeld <sd@tango.flipp.net> | 2014-08-14 13:29:24 +0200 |
---|---|---|
committer | Sebastian Dransfeld <sd@tango.flipp.net> | 2014-08-14 13:30:48 +0200 |
commit | e7198621c585af10e03a467befd05a3eaf5b5e51 (patch) | |
tree | e465433ae54956d5fe9812a878413d04deecdda9 /src/lib | |
parent | b9c2a081059dfe8e73e83e6da1d938e0a2a715fb (diff) |
efreet: use eina_file_mkstemp to create filename
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/efreet/efreet_desktop_command.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/efreet/efreet_desktop_command.c b/src/lib/efreet/efreet_desktop_command.c index 1e4c51d740..bed40dc7c2 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 | |||
74 | int pending; | 74 | int pending; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static int efreet_desktop_command_file_id = 0; | ||
78 | |||
79 | static void *efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop, | 77 | static void *efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop, |
80 | char *exec, int remaining); | 78 | char *exec, int remaining); |
81 | static int efreet_desktop_command_flags_get(Efreet_Desktop *desktop); | 79 | 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 | |||
647 | if (command->flags & EFREET_DESKTOP_EXEC_FLAG_FULLPATH) | 645 | if (command->flags & EFREET_DESKTOP_EXEC_FLAG_FULLPATH) |
648 | { | 646 | { |
649 | char buf[PATH_MAX]; | 647 | char buf[PATH_MAX]; |
648 | Eina_Tmpstr *dest; | ||
649 | int fd; | ||
650 | 650 | ||
651 | snprintf(buf, sizeof(buf), "/tmp/%d-%d-%s", getpid(), | 651 | snprintf(buf, sizeof(buf), "%s_XXXXXX", base); |
652 | efreet_desktop_command_file_id++, base); | 652 | fd = eina_file_mkstemp(buf, &dest); |
653 | f->fullpath = strdup(buf); | 653 | if (fd >= 0) |
654 | f->pending = 1; | 654 | { |
655 | close(fd); | ||
656 | f->fullpath = strdup(dest); | ||
657 | f->pending = 1; | ||
658 | eina_tmpstr_del(dest); | ||
655 | 659 | ||
656 | ecore_file_download(uri, f->fullpath, efreet_desktop_cb_download_complete, | 660 | ecore_file_download(uri, f->fullpath, efreet_desktop_cb_download_complete, |
657 | efreet_desktop_cb_download_progress, f, NULL); | 661 | efreet_desktop_cb_download_progress, f, NULL); |
662 | } | ||
658 | } | 663 | } |
659 | 664 | ||
660 | if (command->flags & EFREET_DESKTOP_EXEC_FLAG_URI) | 665 | if (command->flags & EFREET_DESKTOP_EXEC_FLAG_URI) |