summaryrefslogtreecommitdiff
path: root/src/lib/efreet
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/efreet
parentb95ef3801f9719a8f8ff731e25d66a8d1dd417cd (diff)
fix mingw build for setuid fix/checks
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/efreet_base.c29
-rw-r--r--src/lib/efreet/efreet_menu.c5
2 files changed, 27 insertions, 7 deletions
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