devilhorns pushed a commit to branch master.

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

commit ea77578ad65b65933d911987bbc4d21ab28ebb2e
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Mon Apr 20 12:46:48 2015 -0400

    ecore-evas-extn: Use eina_mkstemp in place of mkstemp
    
    Summary: This fixes Coverity CID1039610 'calling mkstemp without
    securely setting umask first'. Since we have eina_mkstemp which
    already handles creating temporary files in the proper directory,
    let's use it.
    
    @fix
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c 
b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
index 31f83dc..9026615 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c
@@ -19,6 +19,7 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int num,
    char file[PATH_MAX];
    mode_t mode = S_IRUSR | S_IWUSR;
    int page_size;
+   Eina_Tmpstr *tmp;
 
    page_size = eina_cpu_page_size();
 
@@ -40,18 +41,7 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int 
num,
    
    if (b->am_owner)
      {
-        const char *s = NULL;
-        
-#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
-        if (getuid() == geteuid())
-#endif
-          {
-             s = getenv("XDG_RUNTIME_DIR");
-             if (!s) s = getenv("TMPDIR");
-          }
-        if (!s) s = "/tmp";
-        snprintf(file, sizeof(file), "%s/ee-lock-XXXXXX", s);
-        b->lockfd = mkstemp(file);
+        b->lockfd = eina_file_mkstemp("ee-lock-XXXXXX", &tmp);
         if (b->lockfd < 0) goto err;
         b->lock = eina_stringshare_add(file);
         if (!b->lock) goto err;
@@ -69,6 +59,7 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int num,
    if (b->addr == MAP_FAILED) goto err;
    return b;
 err:
+   if (tmp) eina_tmpstr_del(tmp);
    _extnbuf_free(b);
    return NULL;
 }

-- 


Reply via email to