Eina vpath: remove support of ~username vpath on Windows

On Windows, one must be in kernel mode to obtain informations of other users

Reviewed-by: Carsten Haitzler (Rasterman) <rasterman.com>
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9339
This commit is contained in:
Vincent Torri 2019-07-18 04:05:50 +00:00 committed by Marcel Hollerbach
parent f331d1c6cc
commit 89db9df2d2
2 changed files with 10 additions and 7 deletions

View File

@ -195,11 +195,11 @@ eina_vpath_shutdown(void)
return EINA_TRUE;
}
#ifdef HAVE_GETPWENT
static Eina_Bool
_fetch_user_homedir(char **str, const char *name, const char *error)
{
*str = NULL;
#ifdef HAVE_GETPWENT
struct passwd *pwent;
pwent = getpwnam(name);
@ -211,12 +211,8 @@ _fetch_user_homedir(char **str, const char *name, const char *error)
*str = pwent->pw_dir;
return EINA_TRUE;
#else
ERR("User fetching is disabled on this system\nThe string was: %s", error);
return EINA_FALSE;
(void) name;
#endif
}
#endif
static int
_eina_vpath_resolve(const char *path, char *str, size_t size)
@ -232,6 +228,10 @@ _eina_vpath_resolve(const char *path, char *str, size_t size)
}
// ~username/ <- homedir of user "username"
else
#ifndef HAVE_GETPWENT
ERR("User fetching is disabled on this system\nThe string was: %s", path);
return 0;
#else
{
const char *p;
char *name;
@ -248,6 +248,7 @@ _eina_vpath_resolve(const char *path, char *str, size_t size)
return 0;
path = p;
}
#endif
if (home)
{
return snprintf(str, size, "%s%s", home, path);

View File

@ -81,12 +81,14 @@
*
* @since 1.21
*
* @note on Windows, vpath like ~bob/foo is not supported.
*
*/
typedef const char * Eina_Vpath;
/**
* Translate a virtual path into a normal path.
*
*
* The return string is a string allocated by malloc and should be freed with
* free() when no longer needed.
*