summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-04-20 12:46:48 -0400
committerChris Michael <cp.michael@samsung.com>2015-04-20 13:23:47 -0400
commitea77578ad65b65933d911987bbc4d21ab28ebb2e (patch)
treeec7a9980c488365f54e0466a65b8acf9ec436703 /src/modules
parent820eca333ecd63eba6d064071741f8b2d86f1dc1 (diff)
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.michael@samsung.com>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c15
1 files 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,
19 char file[PATH_MAX]; 19 char file[PATH_MAX];
20 mode_t mode = S_IRUSR | S_IWUSR; 20 mode_t mode = S_IRUSR | S_IWUSR;
21 int page_size; 21 int page_size;
22 Eina_Tmpstr *tmp;
22 23
23 page_size = eina_cpu_page_size(); 24 page_size = eina_cpu_page_size();
24 25
@@ -40,18 +41,7 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int num,
40 41
41 if (b->am_owner) 42 if (b->am_owner)
42 { 43 {
43 const char *s = NULL; 44 b->lockfd = eina_file_mkstemp("ee-lock-XXXXXX", &tmp);
44
45#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
46 if (getuid() == geteuid())
47#endif
48 {
49 s = getenv("XDG_RUNTIME_DIR");
50 if (!s) s = getenv("TMPDIR");
51 }
52 if (!s) s = "/tmp";
53 snprintf(file, sizeof(file), "%s/ee-lock-XXXXXX", s);
54 b->lockfd = mkstemp(file);
55 if (b->lockfd < 0) goto err; 45 if (b->lockfd < 0) goto err;
56 b->lock = eina_stringshare_add(file); 46 b->lock = eina_stringshare_add(file);
57 if (!b->lock) goto err; 47 if (!b->lock) goto err;
@@ -69,6 +59,7 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int num,
69 if (b->addr == MAP_FAILED) goto err; 59 if (b->addr == MAP_FAILED) goto err;
70 return b; 60 return b;
71err: 61err:
62 if (tmp) eina_tmpstr_del(tmp);
72 _extnbuf_free(b); 63 _extnbuf_free(b);
73 return NULL; 64 return NULL;
74} 65}