summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/wayland_shm/evas_shm.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 11:27:48 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 18:38:28 +0900
commit9eee1f80fc8fbd852bdf8b42eec663d818ffd5c2 (patch)
tree74de74517fad2db4bd99c749e22e4e628f0b4abe /src/modules/evas/engines/wayland_shm/evas_shm.c
parent3bcd788c7d72b089598c1fc6bb5d6261d9401595 (diff)
evas wayland shm engine - use vpath for getting xdg runtime dir
this should make the wayland shm engine safe to use from setuid processes. it shouldnt depend on getenv of specific file paths if setuid. vpatrh takes care of this in one central place
Diffstat (limited to 'src/modules/evas/engines/wayland_shm/evas_shm.c')
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_shm.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/modules/evas/engines/wayland_shm/evas_shm.c b/src/modules/evas/engines/wayland_shm/evas_shm.c
index 9d9535b7be..05c7ec3945 100644
--- a/src/modules/evas/engines/wayland_shm/evas_shm.c
+++ b/src/modules/evas/engines/wayland_shm/evas_shm.c
@@ -82,11 +82,12 @@ static struct wl_shm_pool *
82_shm_pool_make(struct wl_shm *shm, int size, void **data) 82_shm_pool_make(struct wl_shm *shm, int size, void **data)
83{ 83{
84 struct wl_shm_pool *pool; 84 struct wl_shm_pool *pool;
85 static const char tmp[] = "/evas-wayland_shm-XXXXXX"; 85 static const char tmp[] = "evas-wayland_shm-XXXXXX";
86 const char *path; 86 const char *path;
87 char *name; 87 char *name;
88 int fd = 0; 88 int fd = 0;
89 Eina_Tmpstr *fullname; 89 Eina_Tmpstr *fullname;
90 Efl_Vpath_File *file_obj;
90 91
91 LOGFN(__FILE__, __LINE__, __FUNCTION__); 92 LOGFN(__FILE__, __LINE__, __FUNCTION__);
92 93
@@ -94,19 +95,12 @@ _shm_pool_make(struct wl_shm *shm, int size, void **data)
94 if (!shm) return NULL; 95 if (!shm) return NULL;
95 96
96 /* create tmp file name */ 97 /* create tmp file name */
97 if ((path = getenv("XDG_RUNTIME_DIR"))) 98 file_obj = efl_vpath_manager_fetch(EFL_VPATH_MANAGER_CLASS, "(:run:)/");
98 { 99 efl_vpath_file_do(file_obj);
99 if ((name = malloc(strlen(path) + sizeof(tmp)))) 100 efl_vpath_file_wait(file_obj);
100 strcpy(name, path); 101 path = efl_vpath_file_result_get(file_obj);
101 } 102 if ((name = malloc(strlen(path) + sizeof(tmp)))) strcpy(name, path);
102 else
103 {
104 if ((name = malloc(strlen("/tmp") + sizeof(tmp))))
105 strcpy(name, "/tmp");
106 }
107
108 if (!name) return NULL; 103 if (!name) return NULL;
109
110 strcat(name, tmp); 104 strcat(name, tmp);
111 105
112 fd = eina_file_mkstemp(name, &fullname); 106 fd = eina_file_mkstemp(name, &fullname);