stefan pushed a commit to branch master.

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

commit 693e9095eb519005662bcedc766c60a3165f7ef0
Author: Stefan Schmidt <s.schm...@samsung.com>
Date:   Wed Sep 10 15:41:59 2014 +0200

    edje_cc: Use eina_file_mkstemp() to avoid problems with umask
    
    In this case it also clears up the setup of temp dir.
    
    CID 1039619
---
 src/bin/edje/edje_cc_out.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c
index 0dab938..90d3dca 100755
--- a/src/bin/edje/edje_cc_out.c
+++ b/src/bin/edje/edje_cc_out.c
@@ -127,8 +127,8 @@ struct _Script_Write
    int i;
    Ecore_Exe *exe;
    int tmpn_fd, tmpo_fd;
-   char tmpn[PATH_MAX];
-   char tmpo[PATH_MAX];
+   Eina_Tmpstr *tmpn;
+   Eina_Tmpstr *tmpo;
    char *errstr;
 };
 
@@ -1441,6 +1441,8 @@ data_thread_script(void *data, Ecore_Thread *thread 
EINA_UNUSED)
 
    unlink(sc->tmpn);
    unlink(sc->tmpo);
+   eina_tmpstr_del(sc->tmpn);
+   eina_tmpstr_del(sc->tmpo);
    close(sc->tmpn_fd);
    close(sc->tmpo_fd);
 }
@@ -1493,13 +1495,6 @@ data_write_scripts(Eet_File *ef)
    char inc_path[PATH_MAX] = "";
    int i;
 
-   if (!tmp_dir)
-#ifdef HAVE_EVIL
-     tmp_dir = (char *)evil_tmpdir_get();
-#else
-     tmp_dir = "/tmp";
-#endif
-
 #ifdef _WIN32
 # define BIN_EXT ".exe"
 #else
@@ -1541,16 +1536,15 @@ data_write_scripts(Eet_File *ef)
         sc->ef = ef;
         sc->cd = cd;
         sc->i = i;
-        snprintf(sc->tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmp_dir);
-        sc->tmpn_fd = mkstemp(sc->tmpn);
+        sc->tmpn_fd = eina_file_mkstemp("edje_cc.sma-tmp-XXXXXX", &sc->tmpn);
         if (sc->tmpn_fd < 0)
           error_and_abort(ef, "Unable to open temp file \"%s\" for script "
                           "compilation.", sc->tmpn);
-        snprintf(sc->tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir);
-        sc->tmpo_fd = mkstemp(sc->tmpo);
+        sc->tmpo_fd = eina_file_mkstemp("edje_cc.amx-tmp-XXXXXX", &sc->tmpo);
         if (sc->tmpo_fd < 0)
           {
              unlink(sc->tmpn);
+             eina_tmpstr_del(sc->tmpn);
              error_and_abort(ef, "Unable to open temp file \"%s\" for script "
                              "compilation.", sc->tmpo);
           }

-- 


Reply via email to