diff options
author | Stefan Schmidt <s.schmidt@samsung.com> | 2014-09-10 15:41:59 +0200 |
---|---|---|
committer | Stefan Schmidt <s.schmidt@samsung.com> | 2014-09-10 16:43:02 +0200 |
commit | 693e9095eb519005662bcedc766c60a3165f7ef0 (patch) | |
tree | 512f0848f6724612dedc5e6f42836a7cefe86234 /src/bin/edje | |
parent | 6d67f69061dc0075cef14b26a72aeed1208e15e4 (diff) |
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
Diffstat (limited to 'src/bin/edje')
-rwxr-xr-x | src/bin/edje/edje_cc_out.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index 0dab938df8..90d3dca271 100755 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c | |||
@@ -127,8 +127,8 @@ struct _Script_Write | |||
127 | int i; | 127 | int i; |
128 | Ecore_Exe *exe; | 128 | Ecore_Exe *exe; |
129 | int tmpn_fd, tmpo_fd; | 129 | int tmpn_fd, tmpo_fd; |
130 | char tmpn[PATH_MAX]; | 130 | Eina_Tmpstr *tmpn; |
131 | char tmpo[PATH_MAX]; | 131 | Eina_Tmpstr *tmpo; |
132 | char *errstr; | 132 | char *errstr; |
133 | }; | 133 | }; |
134 | 134 | ||
@@ -1441,6 +1441,8 @@ data_thread_script(void *data, Ecore_Thread *thread EINA_UNUSED) | |||
1441 | 1441 | ||
1442 | unlink(sc->tmpn); | 1442 | unlink(sc->tmpn); |
1443 | unlink(sc->tmpo); | 1443 | unlink(sc->tmpo); |
1444 | eina_tmpstr_del(sc->tmpn); | ||
1445 | eina_tmpstr_del(sc->tmpo); | ||
1444 | close(sc->tmpn_fd); | 1446 | close(sc->tmpn_fd); |
1445 | close(sc->tmpo_fd); | 1447 | close(sc->tmpo_fd); |
1446 | } | 1448 | } |
@@ -1493,13 +1495,6 @@ data_write_scripts(Eet_File *ef) | |||
1493 | char inc_path[PATH_MAX] = ""; | 1495 | char inc_path[PATH_MAX] = ""; |
1494 | int i; | 1496 | int i; |
1495 | 1497 | ||
1496 | if (!tmp_dir) | ||
1497 | #ifdef HAVE_EVIL | ||
1498 | tmp_dir = (char *)evil_tmpdir_get(); | ||
1499 | #else | ||
1500 | tmp_dir = "/tmp"; | ||
1501 | #endif | ||
1502 | |||
1503 | #ifdef _WIN32 | 1498 | #ifdef _WIN32 |
1504 | # define BIN_EXT ".exe" | 1499 | # define BIN_EXT ".exe" |
1505 | #else | 1500 | #else |
@@ -1541,16 +1536,15 @@ data_write_scripts(Eet_File *ef) | |||
1541 | sc->ef = ef; | 1536 | sc->ef = ef; |
1542 | sc->cd = cd; | 1537 | sc->cd = cd; |
1543 | sc->i = i; | 1538 | sc->i = i; |
1544 | snprintf(sc->tmpn, PATH_MAX, "%s/edje_cc.sma-tmp-XXXXXX", tmp_dir); | 1539 | sc->tmpn_fd = eina_file_mkstemp("edje_cc.sma-tmp-XXXXXX", &sc->tmpn); |
1545 | sc->tmpn_fd = mkstemp(sc->tmpn); | ||
1546 | if (sc->tmpn_fd < 0) | 1540 | if (sc->tmpn_fd < 0) |
1547 | error_and_abort(ef, "Unable to open temp file \"%s\" for script " | 1541 | error_and_abort(ef, "Unable to open temp file \"%s\" for script " |
1548 | "compilation.", sc->tmpn); | 1542 | "compilation.", sc->tmpn); |
1549 | snprintf(sc->tmpo, PATH_MAX, "%s/edje_cc.amx-tmp-XXXXXX", tmp_dir); | 1543 | sc->tmpo_fd = eina_file_mkstemp("edje_cc.amx-tmp-XXXXXX", &sc->tmpo); |
1550 | sc->tmpo_fd = mkstemp(sc->tmpo); | ||
1551 | if (sc->tmpo_fd < 0) | 1544 | if (sc->tmpo_fd < 0) |
1552 | { | 1545 | { |
1553 | unlink(sc->tmpn); | 1546 | unlink(sc->tmpn); |
1547 | eina_tmpstr_del(sc->tmpn); | ||
1554 | error_and_abort(ef, "Unable to open temp file \"%s\" for script " | 1548 | error_and_abort(ef, "Unable to open temp file \"%s\" for script " |
1555 | "compilation.", sc->tmpo); | 1549 | "compilation.", sc->tmpo); |
1556 | } | 1550 | } |