diff options
author | Vincent Torri <vincent dot torri at gmail dot com> | 2015-12-08 14:24:59 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2015-12-08 14:24:59 +0900 |
commit | 67f44a3cf8f0fe8335b35c2583ae08ea7b4ddec0 (patch) | |
tree | 7ae0aed77deef3c5a14b18ffc8a05aa46fe624ca | |
parent | a4a82ca0033bf0071fcd97033cc09711a47362d5 (diff) |
Efreet, Elua : use eina_file_mkstemp instead of mkstemp
Reviewers: jpeg
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D3411
-rw-r--r-- | src/lib/elua/cache.c | 16 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_core.c | 12 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_shader.c | 12 |
3 files changed, 8 insertions, 32 deletions
diff --git a/src/lib/elua/cache.c b/src/lib/elua/cache.c index d03d9bfb94..67268a4a2b 100644 --- a/src/lib/elua/cache.c +++ b/src/lib/elua/cache.c | |||
@@ -60,24 +60,16 @@ static FILE * | |||
60 | bc_tmp_open(const char *fname, char *buf, size_t buflen) | 60 | bc_tmp_open(const char *fname, char *buf, size_t buflen) |
61 | { | 61 | { |
62 | int fd; | 62 | int fd; |
63 | #ifndef _WIN32 | 63 | /* FIXME: use ecore_file_file_get() ? */ |
64 | mode_t old_umask; | ||
65 | #endif | ||
66 | char *fs = strrchr(fname, '/'), *bs = strrchr(fname, '\\'); | 64 | char *fs = strrchr(fname, '/'), *bs = strrchr(fname, '\\'); |
67 | if (!fs && !bs) | 65 | if (!fs && !bs) |
68 | snprintf(buf, buflen, "./XXXXXX"); | 66 | snprintf(buf, buflen, "./XXXXXX.cache"); |
69 | else | 67 | else |
70 | { | 68 | { |
71 | char *ss = (fs > bs) ? fs : bs; | 69 | char *ss = (fs > bs) ? fs : bs; |
72 | snprintf(buf, buflen, "%.*sXXXXXX", (int)(ss - fname + 1), fname); | 70 | snprintf(buf, buflen, "%.*sXXXXXX.cache", (int)(ss - fname + 1), fname); |
73 | } | 71 | } |
74 | #ifndef _WIN32 | 72 | fd = eina_file_mkstemp(buf, NULL); |
75 | old_umask = umask(S_IRWXG|S_IRWXO); | ||
76 | #endif | ||
77 | fd = mkstemp(buf); | ||
78 | #ifndef _WIN32 | ||
79 | umask(old_umask); | ||
80 | #endif | ||
81 | if (fd < 0) | 73 | if (fd < 0) |
82 | return NULL; | 74 | return NULL; |
83 | return fdopen(fd, "wb"); | 75 | return fdopen(fd, "wb"); |
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c index e6f8460e9d..633f54a71a 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_core.c +++ b/src/modules/evas/engines/gl_common/evas_gl_core.c | |||
@@ -829,16 +829,8 @@ _surface_cap_cache_save() | |||
829 | sizeof(cap_dir_path)); | 829 | sizeof(cap_dir_path)); |
830 | 830 | ||
831 | /* use mkstemp for writing */ | 831 | /* use mkstemp for writing */ |
832 | snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", cap_file_path); | 832 | snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX.cache", cap_file_path); |
833 | 833 | tmpfd = eina_file_mkstemp(tmp_file, NULL); | |
834 | #ifndef _WIN32 | ||
835 | mode_t old_umask = umask(S_IRWXG|S_IRWXO); | ||
836 | #endif | ||
837 | tmpfd = mkstemp(tmp_file); | ||
838 | #ifndef _WIN32 | ||
839 | umask(old_umask); | ||
840 | #endif | ||
841 | |||
842 | if (tmpfd < 0) goto error; | 834 | if (tmpfd < 0) goto error; |
843 | close(tmpfd); | 835 | close(tmpfd); |
844 | 836 | ||
diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c index dc2449de99..9df1806630 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c | |||
@@ -264,16 +264,8 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared) | |||
264 | sizeof(bin_dir_path)); | 264 | sizeof(bin_dir_path)); |
265 | 265 | ||
266 | /* use mkstemp for writing */ | 266 | /* use mkstemp for writing */ |
267 | snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path); | 267 | snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX.cache", bin_file_path); |
268 | 268 | tmpfd = eina_file_mkstemp(tmp_file, NULL); | |
269 | #ifndef _WIN32 | ||
270 | mode_t old_umask = umask(S_IRWXG|S_IRWXO); | ||
271 | #endif | ||
272 | tmpfd = mkstemp(tmp_file); | ||
273 | #ifndef _WIN32 | ||
274 | umask(old_umask); | ||
275 | #endif | ||
276 | |||
277 | if (tmpfd < 0) return 0; | 269 | if (tmpfd < 0) return 0; |
278 | close(tmpfd); | 270 | close(tmpfd); |
279 | 271 | ||