diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2019-07-18 04:05:50 +0000 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-07-18 09:36:25 +0200 |
commit | 89db9df2d2fccda8d204e50eb27fcfbe84c90f90 (patch) | |
tree | 0eb732f2b2e8e69c60000b07cd41c45c39f8f332 | |
parent | f331d1c6cc1e6f8a7ec7dde37bfaaa11598a53e6 (diff) |
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
-rw-r--r-- | src/lib/eina/eina_vpath.c | 13 | ||||
-rw-r--r-- | src/lib/eina/eina_vpath.h | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c index 0717e928e0..c06ee5abe8 100644 --- a/src/lib/eina/eina_vpath.c +++ b/src/lib/eina/eina_vpath.c | |||
@@ -195,11 +195,11 @@ eina_vpath_shutdown(void) | |||
195 | return EINA_TRUE; | 195 | return EINA_TRUE; |
196 | } | 196 | } |
197 | 197 | ||
198 | #ifdef HAVE_GETPWENT | ||
198 | static Eina_Bool | 199 | static Eina_Bool |
199 | _fetch_user_homedir(char **str, const char *name, const char *error) | 200 | _fetch_user_homedir(char **str, const char *name, const char *error) |
200 | { | 201 | { |
201 | *str = NULL; | 202 | *str = NULL; |
202 | #ifdef HAVE_GETPWENT | ||
203 | struct passwd *pwent; | 203 | struct passwd *pwent; |
204 | 204 | ||
205 | pwent = getpwnam(name); | 205 | pwent = getpwnam(name); |
@@ -211,12 +211,8 @@ _fetch_user_homedir(char **str, const char *name, const char *error) | |||
211 | *str = pwent->pw_dir; | 211 | *str = pwent->pw_dir; |
212 | 212 | ||
213 | return EINA_TRUE; | 213 | return EINA_TRUE; |
214 | #else | ||
215 | ERR("User fetching is disabled on this system\nThe string was: %s", error); | ||
216 | return EINA_FALSE; | ||
217 | (void) name; | ||
218 | #endif | ||
219 | } | 214 | } |
215 | #endif | ||
220 | 216 | ||
221 | static int | 217 | static int |
222 | _eina_vpath_resolve(const char *path, char *str, size_t size) | 218 | _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) | |||
232 | } | 228 | } |
233 | // ~username/ <- homedir of user "username" | 229 | // ~username/ <- homedir of user "username" |
234 | else | 230 | else |
231 | #ifndef HAVE_GETPWENT | ||
232 | ERR("User fetching is disabled on this system\nThe string was: %s", path); | ||
233 | return 0; | ||
234 | #else | ||
235 | { | 235 | { |
236 | const char *p; | 236 | const char *p; |
237 | char *name; | 237 | char *name; |
@@ -248,6 +248,7 @@ _eina_vpath_resolve(const char *path, char *str, size_t size) | |||
248 | return 0; | 248 | return 0; |
249 | path = p; | 249 | path = p; |
250 | } | 250 | } |
251 | #endif | ||
251 | if (home) | 252 | if (home) |
252 | { | 253 | { |
253 | return snprintf(str, size, "%s%s", home, path); | 254 | return snprintf(str, size, "%s%s", home, path); |
diff --git a/src/lib/eina/eina_vpath.h b/src/lib/eina/eina_vpath.h index 77c1e35afe..10b7c1edf2 100644 --- a/src/lib/eina/eina_vpath.h +++ b/src/lib/eina/eina_vpath.h | |||
@@ -81,12 +81,14 @@ | |||
81 | * | 81 | * |
82 | * @since 1.21 | 82 | * @since 1.21 |
83 | * | 83 | * |
84 | * @note on Windows, vpath like ~bob/foo is not supported. | ||
85 | * | ||
84 | */ | 86 | */ |
85 | typedef const char * Eina_Vpath; | 87 | typedef const char * Eina_Vpath; |
86 | 88 | ||
87 | /** | 89 | /** |
88 | * Translate a virtual path into a normal path. | 90 | * Translate a virtual path into a normal path. |
89 | * | 91 | * |
90 | * The return string is a string allocated by malloc and should be freed with | 92 | * The return string is a string allocated by malloc and should be freed with |
91 | * free() when no longer needed. | 93 | * free() when no longer needed. |
92 | * | 94 | * |