summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2020-10-08 11:58:11 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-10-08 11:58:11 +0100
commiteacee53c2e795a1c5e187558ccced2d66390d761 (patch)
tree03d374e1ed454827d64874c3548f564f1df1201b /src/modules
parent509e3fcc7a65918f6bcf8a664353b45af457cfa6 (diff)
Evil : move mkstemp(s) and mkdtemp in eina_file directly
Summary: Also replace all mkstemp(s) and mkdtemp with the eina_file functions in the source Test Plan: run eina_file test Reviewers: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12170
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/elementary/access_output/mod.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/modules/elementary/access_output/mod.c b/src/modules/elementary/access_output/mod.c
index f51b512a47..cabf0a6a55 100644
--- a/src/modules/elementary/access_output/mod.c
+++ b/src/modules/elementary/access_output/mod.c
@@ -19,7 +19,7 @@ static void (*cb_func) (void *data);
19static void *cb_data; 19static void *cb_data;
20static Ecore_Exe *espeak = NULL; 20static Ecore_Exe *espeak = NULL;
21static Ecore_Event_Handler *exe_exit_handler = NULL; 21static Ecore_Event_Handler *exe_exit_handler = NULL;
22static char *tmpf = NULL; 22static Eina_Tmpstr *tmpf = NULL;
23static int tmpfd = -1; 23static int tmpfd = -1;
24 24
25static Eina_Bool 25static Eina_Bool
@@ -32,7 +32,7 @@ _exe_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
32 if (tmpf) 32 if (tmpf)
33 { 33 {
34 unlink(tmpf); 34 unlink(tmpf);
35 free(tmpf); 35 eina_tmpstr_del(tmpf);
36 tmpf = NULL; 36 tmpf = NULL;
37 close(tmpfd); 37 close(tmpfd);
38 tmpfd = -1; 38 tmpfd = -1;
@@ -70,15 +70,12 @@ out_read(const char *txt)
70{ 70{
71 if (!tmpf) 71 if (!tmpf)
72 { 72 {
73 char buf[PATH_MAX];
74 mode_t cur_umask; 73 mode_t cur_umask;
75 74
76 snprintf(buf, sizeof(buf), "/tmp/.elm-speak-XXXXXX");
77 cur_umask = umask(S_IRWXO | S_IRWXG); 75 cur_umask = umask(S_IRWXO | S_IRWXG);
78 tmpfd = mkstemp(buf); 76 tmpfd = eina_file_mkstemp("elm-speak-XXXXXX", &tmpf);
79 umask(cur_umask); 77 umask(cur_umask);
80 if (tmpfd >= 0) tmpf = strdup(buf); 78 if (tmpfd < 0) return;
81 else return;
82 } 79 }
83 if (write(tmpfd, txt, strlen(txt)) < 0) perror("write to tmpfile (espeak)"); 80 if (write(tmpfd, txt, strlen(txt)) < 0) perror("write to tmpfile (espeak)");
84} 81}
@@ -117,7 +114,7 @@ out_cancel(void)
117 if (tmpf) 114 if (tmpf)
118 { 115 {
119 unlink(tmpf); 116 unlink(tmpf);
120 free(tmpf); 117 eina_tmpstr_del(tmpf);
121 tmpf = NULL; 118 tmpf = NULL;
122 close(tmpfd); 119 close(tmpfd);
123 tmpfd = -1; 120 tmpfd = -1;