summaryrefslogtreecommitdiff
path: root/src/lib/ethumb
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/ethumb
parentb95ef3801f9719a8f8ff731e25d66a8d1dd417cd (diff)
fix mingw build for setuid fix/checks
Diffstat (limited to 'src/lib/ethumb')
-rw-r--r--src/lib/ethumb/ethumb.c16
1 files changed, 13 insertions, 3 deletions
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] = '/';