fix mingw build for setuid fix/checks

This commit is contained in:
Carsten Haitzler 2014-01-08 22:08:44 +09:00
parent 430f98a628
commit f165f26f28
4 changed files with 17 additions and 3 deletions

View 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)

View 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;

View 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;

View 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"));