summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2019-07-18 04:05:50 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-18 09:36:25 +0200
commit89db9df2d2fccda8d204e50eb27fcfbe84c90f90 (patch)
tree0eb732f2b2e8e69c60000b07cd41c45c39f8f332 /src/lib/eina
parentf331d1c6cc1e6f8a7ec7dde37bfaaa11598a53e6 (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
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_vpath.c13
-rw-r--r--src/lib/eina/eina_vpath.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/eina/eina_vpath.c b/src/lib/eina/eina_vpath.c
index 0717e92..c06ee5a 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
198static Eina_Bool 199static 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
221static int 217static 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 77c1e35..10b7c1e 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 */
85typedef const char * Eina_Vpath; 87typedef 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 *