fix mingw build for setuid fix/checks
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 8 Jan 2014 13:08:44 +0000 (22:08 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 8 Jan 2014 13:08:44 +0000 (22:08 +0900)
configure.ac
src/lib/elm_cnp.c
src/lib/elm_config.c
src/lib/elm_url.c

index 7f14077..b7fcec9 100644 (file)
@@ -226,6 +226,11 @@ if test "x$want_quicklaunch" != "xno"; then
 fi
 AM_CONDITIONAL([BUILD_QUICKLAUNCH], [test "x$have_fork" = "xyes" && test "x$have_dlopen" = "xyes"])
 
+AC_CHECK_FUNCS([\
+geteuid \
+getuid \
+])
+
 AC_SUBST(dlopen_libs)
 AC_SUBST(lt_enable_auto_import)
 AC_SUBST(ELM_UNIX_DEF)
index 0d8deab..9762897 100644 (file)
@@ -3514,7 +3514,10 @@ _tempfile_new(int size)
 
    info = calloc(1, sizeof(Tmp_Info));
    if (!info) return NULL;
-   if (getuid() == getuid()) tmppath = getenv("TMP");
+#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
+   if (getuid() == geteuid())
+#endif
+     tmppath = getenv("TMP");
    if (!tmppath) tmppath = P_tmpdir;
    len = snprintf(NULL, 0, "%s/%sXXXXXX", tmppath, "elmcnpitem-");
    if (len < 0) goto on_error;
index 502eef9..344e3e1 100644 (file)
@@ -518,7 +518,9 @@ _elm_config_user_dir_snprintf(char       *dst,
      (dst, size, '/', home, strlen(home),
          ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
 #else
-   if (getuid() == getuid())
+#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
+   if (getuid() == geteuid())
+#endif
      {
 #ifdef DOXDG
         home = getenv("XDG_CONFIG_HOME");
@@ -545,6 +547,7 @@ _elm_config_user_dir_snprintf(char       *dst,
 #endif
           }
      }
+#if !defined(HAVE_GETUID) || !defined(HAVE_GETEUID)
    else
      {
         struct passwd *pw = getpwent();
@@ -561,6 +564,7 @@ _elm_config_user_dir_snprintf(char       *dst,
            ELEMENTARY_BASE_DIR, sizeof(ELEMENTARY_BASE_DIR) - 1);
 #endif
      }
+#endif   
 #endif
 
    off = user_dir_len + 1;
index c4bbc52..2f25ed2 100644 (file)
@@ -98,7 +98,9 @@ elm_url_download(const char *url, Elm_Url_Done done_cb, Elm_Url_Cancel cancel_cb
    target = ecore_con_url_new(url);
    if (!target) goto on_error;
 
-   if (getuid() == getuid())
+#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
+   if (getuid() == geteuid())
+#endif
      {
         if (getenv("http_proxy")) ecore_con_url_proxy_set(target, getenv("http_proxy"));
         if (getenv("https_proxy")) ecore_con_url_proxy_set(target, getenv("https_proxy"));