summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-01-08 22:06:41 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-01-08 22:06:41 +0900
commite8c13118eb39a3acaf70430951f7049c53799bae (patch)
tree3a91075c6e93f53c60cea3ebcb714575f0ce5b79 /src/lib
parentb95ef3801f9719a8f8ff731e25d66a8d1dd417cd (diff)
fix mingw build for setuid fix/checks
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore/ecore.c4
-rw-r--r--src/lib/ecore/ecore_exe.c5
-rw-r--r--src/lib/ecore_con/ecore_con_local.c14
-rw-r--r--src/lib/ecore_con/ecore_con_socks.c4
-rw-r--r--src/lib/ecore_evas/ecore_evas_module.c6
-rw-r--r--src/lib/ecore_fb/ecore_fb.c6
-rw-r--r--src/lib/ecore_fb/ecore_fb_ts.c6
-rw-r--r--src/lib/ecore_imf/ecore_imf_module.c4
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c16
-rw-r--r--src/lib/edje/edje_edit.c4
-rw-r--r--src/lib/edje/edje_module.c8
-rw-r--r--src/lib/eeze/eeze_sensor.c6
-rw-r--r--src/lib/efreet/efreet_base.c29
-rw-r--r--src/lib/efreet/efreet_menu.c5
-rw-r--r--src/lib/eina/eina_file_common.c10
-rw-r--r--src/lib/eina/eina_module.c5
-rw-r--r--src/lib/eina/eina_prefix.c12
-rw-r--r--src/lib/emotion/emotion_modules.c4
-rw-r--r--src/lib/ethumb/ethumb.c16
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c8
-rw-r--r--src/lib/evas/file/evas_module.c12
21 files changed, 132 insertions, 52 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index d81cc6b16f..6356b2f12d 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -131,7 +131,9 @@ ecore_system_modules_load(void)
131{ 131{
132 char buf[PATH_MAX] = ""; 132 char buf[PATH_MAX] = "";
133 133
134 if (getuid() == getuid()) 134#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
135 if (getuid() == geteuid())
136#endif
135 { 137 {
136 if (getenv("EFL_RUN_IN_TREE")) 138 if (getenv("EFL_RUN_IN_TREE"))
137 { 139 {
diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c
index f13197216c..c533d654ec 100644
--- a/src/lib/ecore/ecore_exe.c
+++ b/src/lib/ecore/ecore_exe.c
@@ -1609,7 +1609,10 @@ _ecore_exe_exec_it(const char *exe_cmd,
1609 { 1609 {
1610 if (!shell) /* Find users preferred shell. */ 1610 if (!shell) /* Find users preferred shell. */
1611 { 1611 {
1612 if (getuid() == getuid()) shell = getenv("SHELL"); 1612#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
1613 if (getuid() == geteuid())
1614#endif
1615 shell = getenv("SHELL");
1613 if (!shell) 1616 if (!shell)
1614 shell = "/bin/sh"; 1617 shell = "/bin/sh";
1615 } 1618 }
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index 6bd60d24df..20a8d5fbaa 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -73,7 +73,9 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
73 73
74 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) 74 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
75 { 75 {
76 if (getuid() == getuid()) 76#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
77 if (getuid() == geteuid())
78#endif
77 { 79 {
78 homedir = getenv("XDG_RUNTIME_DIR"); 80 homedir = getenv("XDG_RUNTIME_DIR");
79 if (!homedir) 81 if (!homedir)
@@ -88,6 +90,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
88 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name, 90 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name,
89 svr->port); 91 svr->port);
90 } 92 }
93#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID)
91 else 94 else
92 { 95 {
93 struct passwd *pw = getpwent(); 96 struct passwd *pw = getpwent();
@@ -99,7 +102,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
99 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", pw->pw_dir, svr->name, 102 snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", pw->pw_dir, svr->name,
100 svr->port); 103 svr->port);
101 } 104 }
102 105#endif
103 } 106 }
104 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) 107 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
105 { 108 {
@@ -218,7 +221,9 @@ ecore_con_local_listen(
218 221
219 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) 222 if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER)
220 { 223 {
221 if (getuid() == getuid()) 224#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
225 if (getuid() == geteuid())
226#endif
222 { 227 {
223 homedir = getenv("XDG_RUNTIME_DIR"); 228 homedir = getenv("XDG_RUNTIME_DIR");
224 if (!homedir) 229 if (!homedir)
@@ -231,6 +236,7 @@ ecore_con_local_listen(
231 } 236 }
232 } 237 }
233 } 238 }
239#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID)
234 else 240 else
235 { 241 {
236 struct passwd *pw = getpwent(); 242 struct passwd *pw = getpwent();
@@ -238,7 +244,7 @@ ecore_con_local_listen(
238 if ((!pw) || (!pw->pw_dir)) homedir = "/tmp"; 244 if ((!pw) || (!pw->pw_dir)) homedir = "/tmp";
239 else homedir = pw->pw_dir; 245 else homedir = pw->pw_dir;
240 } 246 }
241 247#endif
242 mask = S_IRUSR | S_IWUSR | S_IXUSR; 248 mask = S_IRUSR | S_IWUSR | S_IXUSR;
243 snprintf(buf, sizeof(buf), "%s/.ecore", homedir); 249 snprintf(buf, sizeof(buf), "%s/.ecore", homedir);
244 if (stat(buf, &st) < 0) 250 if (stat(buf, &st) < 0)
diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c
index 379079b165..5ff74b477e 100644
--- a/src/lib/ecore_con/ecore_con_socks.c
+++ b/src/lib/ecore_con/ecore_con_socks.c
@@ -596,7 +596,9 @@ ecore_con_socks_init(void)
596 unsigned char addr6[sizeof(struct in6_addr)]; 596 unsigned char addr6[sizeof(struct in6_addr)];
597#endif 597#endif
598 598
599 if (getuid() == getuid()) 599#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
600 if (getuid() == geteuid())
601#endif
600 { 602 {
601 /* ECORE_CON_SOCKS_V4=[user@]host-port:[1|0] */ 603 /* ECORE_CON_SOCKS_V4=[user@]host-port:[1|0] */
602 socks = getenv("ECORE_CON_SOCKS_V4"); 604 socks = getenv("ECORE_CON_SOCKS_V4");
diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c
index c98f5ad511..5285dc4cfe 100644
--- a/src/lib/ecore_evas/ecore_evas_module.c
+++ b/src/lib/ecore_evas/ecore_evas_module.c
@@ -39,7 +39,9 @@ _ecore_evas_engine_load(const char *engine)
39 { 39 {
40 char tmp[PATH_MAX] = ""; 40 char tmp[PATH_MAX] = "";
41 41
42 if (getuid() == getuid()) 42#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
43 if (getuid() == geteuid())
44#endif
43 { 45 {
44 if (run_in_tree) 46 if (run_in_tree)
45 { 47 {
@@ -81,7 +83,7 @@ _ecore_evas_engine_init(void)
81// _registered_engines = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free)); 83// _registered_engines = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free));
82 _registered_engines = eina_hash_string_small_new(NULL); 84 _registered_engines = eina_hash_string_small_new(NULL);
83 85
84 if (getuid() == getuid()) 86 if (getuid() == geteuid())
85 { 87 {
86 if (getenv("EFL_RUN_IN_TREE")) 88 if (getenv("EFL_RUN_IN_TREE"))
87 { 89 {
diff --git a/src/lib/ecore_fb/ecore_fb.c b/src/lib/ecore_fb/ecore_fb.c
index 3bce09de0b..85ad087d33 100644
--- a/src/lib/ecore_fb/ecore_fb.c
+++ b/src/lib/ecore_fb/ecore_fb.c
@@ -108,7 +108,11 @@ _ecore_fb_size_get(int *w, int *h)
108 struct fb_var_screeninfo fb_var; 108 struct fb_var_screeninfo fb_var;
109 int fb; 109 int fb;
110 110
111 if ((getuid() == getuid()) && (getenv("EVAS_FB_DEV"))) 111 if (
112#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
113 (getuid() == geteuid()) &&
114#endif
115 (getenv("EVAS_FB_DEV")))
112 fb = open(getenv("EVAS_FB_DEV"), O_RDWR); 116 fb = open(getenv("EVAS_FB_DEV"), O_RDWR);
113 else 117 else
114 { 118 {
diff --git a/src/lib/ecore_fb/ecore_fb_ts.c b/src/lib/ecore_fb/ecore_fb_ts.c
index 3f699c05c9..00a3f31530 100644
--- a/src/lib/ecore_fb/ecore_fb_ts.c
+++ b/src/lib/ecore_fb/ecore_fb_ts.c
@@ -81,7 +81,11 @@ ecore_fb_ts_init(void)
81{ 81{
82#ifdef HAVE_TSLIB 82#ifdef HAVE_TSLIB
83 char *tslib_tsdevice = NULL; 83 char *tslib_tsdevice = NULL;
84 if ((getuid() == getuid()) && ((tslib_tsdevice = getenv("TSLIB_TSDEVICE")))) 84 if (
85#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
86 (getuid() == geteuid()) &&
87#endif
88 ((tslib_tsdevice = getenv("TSLIB_TSDEVICE"))))
85 { 89 {
86 printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice ); 90 printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice );
87 _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */ 91 _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */
diff --git a/src/lib/ecore_imf/ecore_imf_module.c b/src/lib/ecore_imf/ecore_imf_module.c
index 3005daa611..b0e1fe0983 100644
--- a/src/lib/ecore_imf/ecore_imf_module.c
+++ b/src/lib/ecore_imf/ecore_imf_module.c
@@ -36,7 +36,9 @@ ecore_imf_module_init(void)
36 "ECORE_IMF", "ecore_imf", "checkme", 36 "ECORE_IMF", "ecore_imf", "checkme",
37 PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, 37 PACKAGE_BIN_DIR, PACKAGE_LIB_DIR,
38 PACKAGE_DATA_DIR, PACKAGE_DATA_DIR); 38 PACKAGE_DATA_DIR, PACKAGE_DATA_DIR);
39 if (getuid() == getuid()) 39#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
40 if (getuid() == geteuid())
41#endif
40 { 42 {
41 if (getenv("EFL_RUN_IN_TREE")) 43 if (getenv("EFL_RUN_IN_TREE"))
42 { 44 {
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c b/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c
index 2a89c59e07..0e737f16a7 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c
@@ -18,19 +18,9 @@ _ecore_xcb_xdefaults_init(void)
18 18
19 LOGFN(__FILE__, __LINE__, __FUNCTION__); 19 LOGFN(__FILE__, __LINE__, __FUNCTION__);
20 20
21 if (getuid() == getuid()) 21 if (getenv("HOME"))
22 { 22 snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME"));
23 if (getenv("HOME")) 23 else return;
24 snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME"));
25 else return;
26 }
27 else
28 {
29 struct passwd *pw = getpwent();
30
31 if ((!pw) || (!pw->pw_dir)) return;
32 snprintf(buff, sizeof(buff), "%s/.Xdefaults", pw->pw_dir);
33 }
34 if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE))) 24 if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE)))
35 { 25 {
36 eina_mmap_safety_enabled_set(EINA_TRUE); 26 eina_mmap_safety_enabled_set(EINA_TRUE);
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 5e686cb287..15c3de9c2e 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -6808,7 +6808,9 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed)
6808#else 6808#else
6809# define BIN_EXT 6809# define BIN_EXT
6810#endif 6810#endif
6811 if (getuid() == getuid()) 6811#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
6812 if (getuid() == geteuid())
6813#endif
6812 { 6814 {
6813 if (getenv("EFL_RUN_IN_TREE")) 6815 if (getenv("EFL_RUN_IN_TREE"))
6814 { 6816 {
diff --git a/src/lib/edje/edje_module.c b/src/lib/edje/edje_module.c
index 52bd47dd28..0e6882c7c1 100644
--- a/src/lib/edje/edje_module.c
+++ b/src/lib/edje/edje_module.c
@@ -37,7 +37,9 @@ _edje_module_handle_load(const char *module)
37 { 37 {
38 char tmp[PATH_MAX] = ""; 38 char tmp[PATH_MAX] = "";
39 39
40 if (getuid() == getuid()) 40#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
41 if (getuid() == geteuid())
42#endif
41 { 43 {
42 if (run_in_tree) 44 if (run_in_tree)
43 { 45 {
@@ -77,7 +79,9 @@ _edje_module_init(void)
77 79
78 _registered_modules = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free)); 80 _registered_modules = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free));
79 81
80 if (getuid() == getuid()) 82#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
83 if (getuid() == geteuid())
84#endif
81 { 85 {
82 if (getenv("EFL_RUN_IN_TREE")) 86 if (getenv("EFL_RUN_IN_TREE"))
83 { 87 {
diff --git a/src/lib/eeze/eeze_sensor.c b/src/lib/eeze/eeze_sensor.c
index 831fb12df2..8a8170c20c 100644
--- a/src/lib/eeze/eeze_sensor.c
+++ b/src/lib/eeze/eeze_sensor.c
@@ -82,7 +82,11 @@ eeze_sensor_modules_load(void)
82 * is one of these items. We do load the modules from the builddir if the 82 * is one of these items. We do load the modules from the builddir if the
83 * environment is set. Normal case is to use installed modules from system 83 * environment is set. Normal case is to use installed modules from system
84 */ 84 */
85 if ((getuid() == getuid()) && (getenv("EFL_RUN_IN_TREE"))) 85 if (
86#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
87 (getuid() == geteuid()) &&
88#endif
89 (getenv("EFL_RUN_IN_TREE")))
86 { 90 {
87 const char **itr; 91 const char **itr;
88 92
diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c
index 5836d95a5d..7bde732bae 100644
--- a/src/lib/efreet/efreet_base.c
+++ b/src/lib/efreet/efreet_base.c
@@ -278,18 +278,24 @@ efreet_dirs_init(void)
278 struct stat st; 278 struct stat st;
279 279
280 /* efreet_home_dir */ 280 /* efreet_home_dir */
281 if (getuid() == getuid()) 281#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
282 if (getuid() == geteuid())
283#endif
282 efreet_home_dir = getenv("HOME"); 284 efreet_home_dir = getenv("HOME");
285#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID)
283 else 286 else
284 { 287 {
285 struct passwd *pw = getpwent(); 288 struct passwd *pw = getpwent();
286 289
287 if ((pw) && (pw->pw_dir)) efreet_home_dir = pw->pw_dir; 290 if ((pw) && (pw->pw_dir)) efreet_home_dir = pw->pw_dir;
288 } 291 }
292#endif
289#ifdef _WIN32 293#ifdef _WIN32
290 if (!efreet_home_dir || efreet_home_dir[0] == '\0') 294 if (!efreet_home_dir || efreet_home_dir[0] == '\0')
291 { 295 {
292 if (getuid() == getuid()) 296#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
297 if (getuid() == geteuid())
298#endif
293 efreet_home_dir = getenv("USERPROFILE"); 299 efreet_home_dir = getenv("USERPROFILE");
294 } 300 }
295#endif 301#endif
@@ -315,7 +321,10 @@ efreet_dirs_init(void)
315 xdg_config_dirs = efreet_dirs_get("XDG_CONFIG_DIRS", "/etc/xdg"); 321 xdg_config_dirs = efreet_dirs_get("XDG_CONFIG_DIRS", "/etc/xdg");
316 322
317 /* xdg_runtime_dir */ 323 /* xdg_runtime_dir */
318 if (getuid() == getuid()) xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); 324#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
325 if (getuid() == geteuid())
326#endif
327 xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
319 if (!xdg_runtime_dir) 328 if (!xdg_runtime_dir)
320 { 329 {
321 snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX"); 330 snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
@@ -390,7 +399,10 @@ efreet_dir_get(const char *key, const char *fallback)
390 char *dir = NULL; 399 char *dir = NULL;
391 const char *t; 400 const char *t;
392 401
393 if (getuid() == getuid()) dir = getenv(key); 402#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
403 if (getuid() == geteuid())
404#endif
405 dir = getenv(key);
394 if (!dir || dir[0] == '\0') 406 if (!dir || dir[0] == '\0')
395 { 407 {
396 int len; 408 int len;
@@ -425,7 +437,10 @@ efreet_dirs_get(const char *key, const char *fallback)
425 char *s, *p; 437 char *s, *p;
426 size_t len; 438 size_t len;
427 439
428 if (getuid() == getuid()) path = getenv(key); 440#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
441 if (getuid() == geteuid())
442#endif
443 path = getenv(key);
429 if (!path || (path[0] == '\0')) path = fallback; 444 if (!path || (path[0] == '\0')) path = fallback;
430 445
431 if (!path) return dirs; 446 if (!path) return dirs;
@@ -496,7 +511,9 @@ efreet_env_expand(const char *in)
496 { 511 {
497 memcpy(env, e1, len); 512 memcpy(env, e1, len);
498 env[len] = 0; 513 env[len] = 0;
499 if (getuid() == getuid()) 514#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
515 if (getuid() == geteuid())
516#endif
500 { 517 {
501 val = getenv(env); 518 val = getenv(env);
502 if (val) eina_strbuf_append(sb, val); 519 if (val) eina_strbuf_append(sb, val);
diff --git a/src/lib/efreet/efreet_menu.c b/src/lib/efreet/efreet_menu.c
index 1af99f1b0a..03ce851e6e 100644
--- a/src/lib/efreet/efreet_menu.c
+++ b/src/lib/efreet/efreet_menu.c
@@ -14,6 +14,7 @@ static int _efreet_menu_log_dom = -1;
14#include "Efreet.h" 14#include "Efreet.h"
15#include "efreet_private.h" 15#include "efreet_private.h"
16#include "efreet_xml.h" 16#include "efreet_xml.h"
17#include <unistd.h>
17 18
18typedef struct Efreet_Menu_Move Efreet_Menu_Move; 19typedef struct Efreet_Menu_Move Efreet_Menu_Move;
19 20
@@ -399,7 +400,9 @@ efreet_menu_init(void)
399 return 0; 400 return 0;
400 } 401 }
401 402
402 if (getuid() == getuid()) 403#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
404 if (getuid() == geteuid())
405#endif
403 efreet_menu_prefix = getenv("XDG_MENU_PREFIX"); 406 efreet_menu_prefix = getenv("XDG_MENU_PREFIX");
404 if (!efreet_menu_prefix) efreet_menu_prefix = ""; 407 if (!efreet_menu_prefix) efreet_menu_prefix = "";
405 408
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index a0389943a9..37f3f51c53 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -902,7 +902,10 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
902 mode_t old_umask; 902 mode_t old_umask;
903 903
904#ifndef HAVE_EVIL 904#ifndef HAVE_EVIL
905 if (getuid() == getuid()) tmpdir = getenv("TMPDIR"); 905#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
906 if (getuid() == geteuid())
907#endif
908 tmpdir = getenv("TMPDIR");
906 if (!tmpdir) tmpdir = "/tmp"; 909 if (!tmpdir) tmpdir = "/tmp";
907#else 910#else
908 tmpdir = (char *)evil_tmpdir_get(); 911 tmpdir = (char *)evil_tmpdir_get();
@@ -933,7 +936,10 @@ eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path)
933 char *tmpdirname; 936 char *tmpdirname;
934 937
935#ifndef HAVE_EVIL 938#ifndef HAVE_EVIL
936 if (getuid() == getuid()) tmpdir = getenv("TMPDIR"); 939#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
940 if (getuid() == geteuid())
941#endif
942 tmpdir = getenv("TMPDIR");
937 if (!tmpdir) tmpdir = "/tmp"; 943 if (!tmpdir) tmpdir = "/tmp";
938#else 944#else
939 tmpdir = (char *)evil_tmpdir_get(); 945 tmpdir = (char *)evil_tmpdir_get();
diff --git a/src/lib/eina/eina_module.c b/src/lib/eina/eina_module.c
index 8c81873dc6..29b680277f 100644
--- a/src/lib/eina/eina_module.c
+++ b/src/lib/eina/eina_module.c
@@ -431,8 +431,9 @@ EAPI char *eina_module_environment_path_get(const char *env,
431 const char *env_dir; 431 const char *env_dir;
432 432
433 EINA_SAFETY_ON_NULL_RETURN_VAL(env, NULL); 433 EINA_SAFETY_ON_NULL_RETURN_VAL(env, NULL);
434 if (getuid() != getuid()) return NULL; // if setuid dont use dangerous env 434#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
435 435 if (getuid() != geteuid()) return NULL; // if setuid dont use dangerous env
436#endif
436 env_dir = getenv(env); 437 env_dir = getenv(env);
437 if (env_dir) 438 if (env_dir)
438 { 439 {
diff --git a/src/lib/eina/eina_prefix.c b/src/lib/eina/eina_prefix.c
index 3e8709f335..7428ec377f 100644
--- a/src/lib/eina/eina_prefix.c
+++ b/src/lib/eina/eina_prefix.c
@@ -335,7 +335,9 @@ _try_argv(Eina_Prefix *pfx, const char *argv0)
335 } 335 }
336 336
337 /* 3. argv0 no path - look in PATH */ 337 /* 3. argv0 no path - look in PATH */
338 if (getuid() != getuid()) return 0; 338#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
339 if (getuid() != geteuid()) return 0;
340#endif
339 path = getenv("PATH"); 341 path = getenv("PATH");
340 if (!path) 342 if (!path)
341 { 343 {
@@ -384,7 +386,9 @@ _get_env_var(char **var, const char *envprefix, const char *envsuffix, const cha
384 char env[1024]; 386 char env[1024];
385 const char *s; 387 const char *s;
386 388
387 if (getuid() != getuid()) return 0; 389#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
390 if (getuid() != geteuid()) return 0;
391#endif
388 snprintf(env, sizeof(env), "%s_%s_DIR", envprefix, envsuffix); 392 snprintf(env, sizeof(env), "%s_%s_DIR", envprefix, envsuffix);
389 s = getenv(env); 393 s = getenv(env);
390 if (s) 394 if (s)
@@ -420,7 +424,9 @@ _get_env_vars(Eina_Prefix *pfx,
420 const char *prefix; 424 const char *prefix;
421 int ret = 0; 425 int ret = 0;
422 426
423 if (getuid() == getuid()) 427#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
428 if (getuid() == geteuid())
429#endif
424 { 430 {
425 snprintf(env, sizeof(env), "%s_PREFIX", envprefix); 431 snprintf(env, sizeof(env), "%s_PREFIX", envprefix);
426 if ((prefix = getenv(env))) STRDUP_REP(pfx->prefix_path, prefix); 432 if ((prefix = getenv(env))) STRDUP_REP(pfx->prefix_path, prefix);
diff --git a/src/lib/emotion/emotion_modules.c b/src/lib/emotion/emotion_modules.c
index d39c575ceb..afbf9416ea 100644
--- a/src/lib/emotion/emotion_modules.c
+++ b/src/lib/emotion/emotion_modules.c
@@ -58,7 +58,9 @@ _emotion_modules_load(void)
58 if (_emotion_modules_loaded) return; 58 if (_emotion_modules_loaded) return;
59 _emotion_modules_loaded = EINA_TRUE; 59 _emotion_modules_loaded = EINA_TRUE;
60 60
61 if (getuid() == getuid()) 61#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
62 if (getuid() == geteuid())
63#endif
62 { 64 {
63 if (getenv("EFL_RUN_IN_TREE")) 65 if (getenv("EFL_RUN_IN_TREE"))
64 { 66 {
diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c
index c408be516d..e3b3764d57 100644
--- a/src/lib/ethumb/ethumb.c
+++ b/src/lib/ethumb/ethumb.c
@@ -159,7 +159,9 @@ _ethumb_plugins_load(void)
159 if (_plugins_loaded) return; 159 if (_plugins_loaded) return;
160 _plugins_loaded = EINA_TRUE; 160 _plugins_loaded = EINA_TRUE;
161 161
162 if (getuid() == getuid()) 162#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
163 if (getuid() == geteuid())
164#endif
163 { 165 {
164 if (getenv("EFL_RUN_IN_TREE")) 166 if (getenv("EFL_RUN_IN_TREE"))
165 { 167 {
@@ -257,11 +259,14 @@ ethumb_init(void)
257 ecore_evas_init(); 259 ecore_evas_init();
258 edje_init(); 260 edje_init();
259 261
260 if (getuid() == getuid()) 262#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
263 if (getuid() == geteuid())
264#endif
261 { 265 {
262 home = getenv("HOME"); 266 home = getenv("HOME");
263 snprintf(buf, sizeof(buf), "%s/.thumbnails", home); 267 snprintf(buf, sizeof(buf), "%s/.thumbnails", home);
264 } 268 }
269#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID)
265 else 270 else
266 { 271 {
267 struct passwd *pw = getpwent(); 272 struct passwd *pw = getpwent();
@@ -269,6 +274,7 @@ ethumb_init(void)
269 if ((!pw) || (!pw->pw_dir)) goto error_plugins_ext; 274 if ((!pw) || (!pw->pw_dir)) goto error_plugins_ext;
270 snprintf(buf, sizeof(buf), "%s/.thumbnails", pw->pw_dir); 275 snprintf(buf, sizeof(buf), "%s/.thumbnails", pw->pw_dir);
271 } 276 }
277#endif
272 278
273 _home_thumb_dir = eina_stringshare_add(buf); 279 _home_thumb_dir = eina_stringshare_add(buf);
274 _thumb_category_normal = eina_stringshare_add("normal"); 280 _thumb_category_normal = eina_stringshare_add("normal");
@@ -707,13 +713,16 @@ _ethumb_build_absolute_path(const char *path, char buf[PATH_MAX])
707 } 713 }
708 else if (path[0] == '~') 714 else if (path[0] == '~')
709 { 715 {
710 if (getuid() == getuid()) 716#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
717 if (getuid() == geteuid())
718#endif
711 { 719 {
712 const char *home = getenv("HOME"); 720 const char *home = getenv("HOME");
713 if (!home) return NULL; 721 if (!home) return NULL;
714 strncpy(p, home, PATH_MAX - 1); 722 strncpy(p, home, PATH_MAX - 1);
715 p[PATH_MAX - 1] = 0; 723 p[PATH_MAX - 1] = 0;
716 } 724 }
725#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID)
717 else 726 else
718 { 727 {
719 struct passwd *pw = getpwent(); 728 struct passwd *pw = getpwent();
@@ -722,6 +731,7 @@ _ethumb_build_absolute_path(const char *path, char buf[PATH_MAX])
722 strncpy(p, pw->pw_dir, PATH_MAX - 1); 731 strncpy(p, pw->pw_dir, PATH_MAX - 1);
723 p[PATH_MAX - 1] = 0; 732 p[PATH_MAX - 1] = 0;
724 } 733 }
734#endif
725 len = strlen(p); 735 len = strlen(p);
726 p += len; 736 p += len;
727 p[0] = '/'; 737 p[0] = '/';
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 0afd91f3fa..ab6c30eeeb 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -128,7 +128,9 @@ _socket_path_set(char *path)
128 char *env; 128 char *env;
129 char buf[UNIX_PATH_MAX]; 129 char buf[UNIX_PATH_MAX];
130 130
131 if (getuid() == getuid()) 131#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
132 if (getuid() == geteuid())
133#endif
132 { 134 {
133 env = getenv("EVAS_CSERVE2_SOCKET"); 135 env = getenv("EVAS_CSERVE2_SOCKET");
134 if (env && env[0]) 136 if (env && env[0])
@@ -142,7 +144,9 @@ _socket_path_set(char *path)
142 /* FIXME: check we can actually create this socket */ 144 /* FIXME: check we can actually create this socket */
143 strcpy(path, buf); 145 strcpy(path, buf);
144#if 0 146#if 0
145 if (getuid() == getuid()) 147#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
148 if (getuid() == geteuid())
149#endif
146 { 150 {
147 env = getenv("XDG_RUNTIME_DIR"); 151 env = getenv("XDG_RUNTIME_DIR");
148 if (!env || !env[0]) 152 if (!env || !env[0])
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index 01bf0b0f1d..28b4243cdd 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -56,7 +56,9 @@ evas_module_paths_init(void)
56{ 56{
57 char *libdir, *path; 57 char *libdir, *path;
58 58
59 if (getuid() == getuid()) 59#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
60 if (getuid() == geteuid())
61#endif
60 { 62 {
61 if (getenv("EFL_RUN_IN_TREE")) 63 if (getenv("EFL_RUN_IN_TREE"))
62 { 64 {
@@ -326,7 +328,9 @@ evas_module_engine_list(void)
326 const char *fname = fi->path + fi->name_start; 328 const char *fname = fi->path + fi->name_start;
327 329
328 buf[0] = '\0'; 330 buf[0] = '\0';
329 if (getuid() == getuid()) 331#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
332 if (getuid() == geteuid())
333#endif
330 { 334 {
331 if (run_in_tree) 335 if (run_in_tree)
332 { 336 {
@@ -425,7 +429,9 @@ evas_module_find_type(Evas_Module_Type type, const char *name)
425 } 429 }
426 430
427 buffer[0] = '\0'; 431 buffer[0] = '\0';
428 if (getuid() == getuid()) 432#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
433 if (getuid() == geteuid())
434#endif
429 { 435 {
430 if (run_in_tree) 436 if (run_in_tree)
431 { 437 {