From: Carsten Haitzler (Rasterman) Date: Wed, 8 Jan 2014 13:08:44 +0000 (+0900) Subject: fix mingw build for setuid fix/checks X-Git-Tag: v1.9.0-alpha1~281 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84e91b687b99376738728cf33324532c828551a3;p=platform%2Fupstream%2Felementary.git fix mingw build for setuid fix/checks --- diff --git a/configure.ac b/configure.ac index 7f14077..b7fcec9 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c index 0d8deab..9762897 100644 --- a/src/lib/elm_cnp.c +++ b/src/lib/elm_cnp.c @@ -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; diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c index 502eef9..344e3e1 100644 --- a/src/lib/elm_config.c +++ b/src/lib/elm_config.c @@ -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; diff --git a/src/lib/elm_url.c b/src/lib/elm_url.c index c4bbc52..2f25ed2 100644 --- a/src/lib/elm_url.c +++ b/src/lib/elm_url.c @@ -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"));