summaryrefslogtreecommitdiff
path: root/src/lib/elua
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2015-12-08 14:24:59 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-08 14:24:59 +0900
commit67f44a3cf8f0fe8335b35c2583ae08ea7b4ddec0 (patch)
tree7ae0aed77deef3c5a14b18ffc8a05aa46fe624ca /src/lib/elua
parenta4a82ca0033bf0071fcd97033cc09711a47362d5 (diff)
Efreet, Elua : use eina_file_mkstemp instead of mkstemp
Reviewers: jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3411
Diffstat (limited to 'src/lib/elua')
-rw-r--r--src/lib/elua/cache.c16
1 files changed, 4 insertions, 12 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 *
60bc_tmp_open(const char *fname, char *buf, size_t buflen) 60bc_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");