summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--header_checks/meson.build1
-rw-r--r--src/lib/eio/Eio_Legacy.h3
-rw-r--r--src/lib/eio/eio_single.c22
3 files changed, 17 insertions, 9 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build
index 35b5db9fdd..4f71dbde5c 100644
--- a/header_checks/meson.build
+++ b/header_checks/meson.build
@@ -78,6 +78,7 @@ function_checks = [
78 ['alloca', ['alloca.h']], 78 ['alloca', ['alloca.h']],
79 ['backtrace', ['execinfo.h']], 79 ['backtrace', ['execinfo.h']],
80 ['backtrace_symbols', ['execinfo.h']], 80 ['backtrace_symbols', ['execinfo.h']],
81 ['chown', ['unistd.h']],
81 ['clock_gettime', ['time.h']], 82 ['clock_gettime', ['time.h']],
82 ['dirfd', ['dirent.h sys/types.h']], 83 ['dirfd', ['dirent.h sys/types.h']],
83 ['fchmod', ['sys/stat.h']], 84 ['fchmod', ['sys/stat.h']],
diff --git a/src/lib/eio/Eio_Legacy.h b/src/lib/eio/Eio_Legacy.h
index ac7a814f5f..50140edd4e 100644
--- a/src/lib/eio/Eio_Legacy.h
+++ b/src/lib/eio/Eio_Legacy.h
@@ -394,6 +394,9 @@ EAPI Eio_File *eio_file_chmod(const char *path,
394 * 394 *
395 * This function will change the owner of a path, setting it to the user and 395 * This function will change the owner of a path, setting it to the user and
396 * group passed as argument. It's equivalent to the chown shell command. 396 * group passed as argument. It's equivalent to the chown shell command.
397 *
398 * @note Some platforms (including Windows) do not support chown(). In that
399 * case, this function returns @c NULL.
397 */ 400 */
398EAPI Eio_File *eio_file_chown(const char *path, 401EAPI Eio_File *eio_file_chown(const char *path,
399 const char *user, 402 const char *user,
diff --git a/src/lib/eio/eio_single.c b/src/lib/eio/eio_single.c
index 1701f1006e..3fd11a59cb 100644
--- a/src/lib/eio/eio_single.c
+++ b/src/lib/eio/eio_single.c
@@ -204,16 +204,10 @@ _eio_file_chmod(void *data, Ecore_Thread *thread)
204 eio_file_thread_error(&ch->common, thread); 204 eio_file_thread_error(&ch->common, thread);
205} 205}
206 206
207#if defined(HAVE_CHOWN) && defined(HAVE_GETPWENT)
207static void 208static void
208_eio_file_chown(void *data, Ecore_Thread *thread) 209_eio_file_chown(void *data, Ecore_Thread *thread)
209{ 210{
210#ifdef _WIN32
211 /* FIXME:
212 * look at http://wwwthep.physik.uni-mainz.de/~frink/chown/readme.html
213 */
214 (void)data;
215 (void)thread;
216#else
217 Eio_File_Chown *own = data; 211 Eio_File_Chown *own = data;
218 char *tmp; 212 char *tmp;
219 uid_t owner = -1; 213 uid_t owner = -1;
@@ -266,7 +260,6 @@ _eio_file_chown(void *data, Ecore_Thread *thread)
266 on_error: 260 on_error:
267 ecore_thread_cancel(thread); 261 ecore_thread_cancel(thread);
268 return; 262 return;
269#endif
270} 263}
271 264
272static void 265static void
@@ -297,6 +290,7 @@ _eio_file_chown_error(void *data, Ecore_Thread *thread EINA_UNUSED)
297 eio_file_error(&ch->common); 290 eio_file_error(&ch->common);
298 _eio_chown_free(ch); 291 _eio_chown_free(ch);
299} 292}
293#endif
300 294
301/** 295/**
302 * @endcond 296 * @endcond
@@ -585,6 +579,7 @@ eio_file_chown(const char *path,
585 Eio_Error_Cb error_cb, 579 Eio_Error_Cb error_cb,
586 const void *data) 580 const void *data)
587{ 581{
582#if defined(HAVE_CHOWN) && defined(HAVE_GETPWENT)
588 Eio_File_Chown *c = NULL; 583 Eio_File_Chown *c = NULL;
589 584
590 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); 585 EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
@@ -601,11 +596,20 @@ eio_file_chown(const char *path,
601 if (!eio_file_set(&c->common, 596 if (!eio_file_set(&c->common,
602 done_cb, 597 done_cb,
603 error_cb, 598 error_cb,
604 data, 599 data,
605 _eio_file_chown, 600 _eio_file_chown,
606 _eio_file_chown_done, 601 _eio_file_chown_done,
607 _eio_file_chown_error)) 602 _eio_file_chown_error))
608 return NULL; 603 return NULL;
609 604
610 return &c->common; 605 return &c->common;
606#else
607 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
608 error_cb(data, NULL, EINVAL);
609 return NULL;
610 (void)path;
611 (void)user;
612 (void)group;
613 (void)done_cb;
614#endif
611} 615}