jpeg pushed a commit to branch master.

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

commit 67f44a3cf8f0fe8335b35c2583ae08ea7b4ddec0
Author: Vincent Torri <vincent dot torri at gmail dot com>
Date:   Tue Dec 8 14:24:59 2015 +0900

    Efreet, Elua : use eina_file_mkstemp instead of mkstemp
    
    Reviewers: jpeg
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3411
---
 src/lib/elua/cache.c                                | 16 ++++------------
 src/modules/evas/engines/gl_common/evas_gl_core.c   | 12 ++----------
 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 d03d9bf..67268a4 100644
--- a/src/lib/elua/cache.c
+++ b/src/lib/elua/cache.c
@@ -60,24 +60,16 @@ static FILE *
 bc_tmp_open(const char *fname, char *buf, size_t buflen)
 {
    int fd;
-#ifndef _WIN32
-   mode_t old_umask;
-#endif
+   /* FIXME: use ecore_file_file_get() ? */
    char *fs = strrchr(fname, '/'), *bs = strrchr(fname, '\\');
    if (!fs && !bs)
-     snprintf(buf, buflen, "./XXXXXX");
+     snprintf(buf, buflen, "./XXXXXX.cache");
    else
      {
         char *ss = (fs > bs) ? fs : bs;
-        snprintf(buf, buflen, "%.*sXXXXXX", (int)(ss - fname + 1), fname);
+        snprintf(buf, buflen, "%.*sXXXXXX.cache", (int)(ss - fname + 1), 
fname);
      }
-#ifndef _WIN32
-   old_umask = umask(S_IRWXG|S_IRWXO);
-#endif
-   fd = mkstemp(buf);
-#ifndef _WIN32
-   umask(old_umask);
-#endif
+   fd = eina_file_mkstemp(buf, NULL);
    if (fd < 0)
      return NULL;
    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 e6f8460..633f54a 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()
                                         sizeof(cap_dir_path));
 
    /* use mkstemp for writing */
-   snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", cap_file_path);
-
-#ifndef _WIN32
-   mode_t old_umask = umask(S_IRWXG|S_IRWXO);
-#endif
-   tmpfd = mkstemp(tmp_file);
-#ifndef _WIN32
-   umask(old_umask);
-#endif
-
+   snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX.cache", cap_file_path);
+   tmpfd = eina_file_mkstemp(tmp_file, NULL);
    if (tmpfd < 0) goto error;
    close(tmpfd);
 
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 dc2449d..9df1806 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)
                                                sizeof(bin_dir_path));
 
    /* use mkstemp for writing */
-   snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path);
-
-#ifndef _WIN32
-   mode_t old_umask = umask(S_IRWXG|S_IRWXO);
-#endif
-   tmpfd = mkstemp(tmp_file);
-#ifndef _WIN32
-   umask(old_umask);
-#endif
-
+   snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX.cache", bin_file_path);
+   tmpfd = eina_file_mkstemp(tmp_file, NULL);
    if (tmpfd < 0) return 0;
    close(tmpfd);
 

-- 


Reply via email to