summaryrefslogtreecommitdiff
path: root/src/bin/edje
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2014-09-10 16:27:34 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2014-09-10 16:43:02 +0200
commitcbc6cdda89102022ac02034692fe55a23ac6c0a9 (patch)
tree1e38e1ca424efe13e85f1f005269c7454ea2a29c /src/bin/edje
parent693e9095eb519005662bcedc766c60a3165f7ef0 (diff)
edje_cc_parse: Use eina_file_mkstemp() to avoid problems with umask
CID 1039618
Diffstat (limited to 'src/bin/edje')
-rw-r--r--src/bin/edje/edje_cc_parse.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/bin/edje/edje_cc_parse.c b/src/bin/edje/edje_cc_parse.c
index b8286e93e6..cfefb45785 100644
--- a/src/bin/edje/edje_cc_parse.c
+++ b/src/bin/edje/edje_cc_parse.c
@@ -851,11 +851,15 @@ parse(char *data, off_t size)
851 DBG("Parsing done"); 851 DBG("Parsing done");
852} 852}
853 853
854static char *clean_file = NULL; 854Eina_Tmpstr *clean_file = NULL;
855static void 855static void
856clean_tmp_file(void) 856clean_tmp_file(void)
857{ 857{
858 if (clean_file) unlink(clean_file); 858 if (clean_file)
859 {
860 unlink(clean_file);
861 eina_tmpstr_del(clean_file);
862 }
859} 863}
860 864
861int 865int
@@ -901,27 +905,19 @@ compile(void)
901{ 905{
902 char buf[4096], buf2[4096]; 906 char buf[4096], buf2[4096];
903 char inc[4096]; 907 char inc[4096];
904 static char tmpn[4096]; 908 Eina_Tmpstr *tmpn;
905 int fd; 909 int fd;
906 off_t size; 910 off_t size;
907 char *data, *p; 911 char *data, *p;
908 Eina_List *l; 912 Eina_List *l;
909 Edje_Style *stl; 913 Edje_Style *stl;
910 914
911 if (!tmp_dir)
912#ifdef HAVE_EVIL
913 tmp_dir = (char *)evil_tmpdir_get();
914#else
915 tmp_dir = "/tmp";
916#endif
917
918 strncpy(inc, file_in, 4000); 915 strncpy(inc, file_in, 4000);
919 inc[4001] = 0; 916 inc[4001] = 0;
920 p = strrchr(inc, '/'); 917 p = strrchr(inc, '/');
921 if (!p) strcpy(inc, "./"); 918 if (!p) strcpy(inc, "./");
922 else *p = 0; 919 else *p = 0;
923 snprintf(tmpn, PATH_MAX, "%s/edje_cc.edc-tmp-XXXXXX", tmp_dir); 920 fd = eina_file_mkstemp("edje_cc.edc-tmp-XXXXXX", &tmpn);
924 fd = mkstemp(tmpn);
925 if (fd < 0) 921 if (fd < 0)
926 { 922 {
927 CRI("Unable to open temp file \"%s\" for pre-processor.", tmpn); 923 CRI("Unable to open temp file \"%s\" for pre-processor.", tmpn);
@@ -995,7 +991,7 @@ compile(void)
995 exit(-1); 991 exit(-1);
996 } 992 }
997 if (ret == EXIT_SUCCESS) 993 if (ret == EXIT_SUCCESS)
998 file_in = tmpn; 994 file_in = (char *)tmpn;
999 else 995 else
1000 { 996 {
1001 ERR("Exit code of epp not clean: %i", ret); 997 ERR("Exit code of epp not clean: %i", ret);