SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 65 in 5 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/header_checks/meson.build b/header_checks/meson.build
  2. index ff5b21ee0c..394f30dd8c 100644
  3. --- a/header_checks/meson.build
  4. +++ b/header_checks/meson.build
  5. @@ -78,6 +78,7 @@ function_checks = [
  6.    ['alloca', ['alloca.h']],
  7.    ['backtrace', ['execinfo.h']],
  8.    ['backtrace_symbols', ['execinfo.h']],
  9. +  ['chown', ['unistd.h']],
  10.    ['clock_gettime', ['time.h']],
  11.    ['dirfd', ['dirent.h sys/types.h']],
  12.    ['fchmod', ['sys/stat.h']],
  13. diff --git a/src/lib/eio/Eio_Legacy.h b/src/lib/eio/Eio_Legacy.h
  14. index ac7a814f5f..50140edd4e 100644
  15. --- a/src/lib/eio/Eio_Legacy.h
  16. +++ b/src/lib/eio/Eio_Legacy.h
  17. @@ -394,6 +394,9 @@ EAPI Eio_File *eio_file_chmod(const char *path,
  18.   *
  19.   * This function will change the owner of a path, setting it to the user and
  20.   * group passed as argument. It's equivalent to the chown shell command.
  21. + *
  22. + * @note Some platforms (including Windows) do not support chown(). In that
  23. + * case, this function returns @c NULL.
  24.   */
  25.  EAPI Eio_File *eio_file_chown(const char *path,
  26.                                const char *user,
  27. diff --git a/src/lib/eio/eio_single.c b/src/lib/eio/eio_single.c
  28. index 1701f1006e..0c5eaa8fbf 100644
  29. --- a/src/lib/eio/eio_single.c
  30. +++ b/src/lib/eio/eio_single.c
  31. @@ -204,16 +204,10 @@ _eio_file_chmod(void *data, Ecore_Thread *thread)
  32.       eio_file_thread_error(&ch->common, thread);
  33.  }
  34.  
  35. +#ifdef HAVE_CHOWN
  36.  static void
  37.  _eio_file_chown(void *data, Ecore_Thread *thread)
  38.  {
  39. -#ifdef _WIN32
  40. -  /* FIXME:
  41. -   * look at http://wwwthep.physik.uni-mainz.de/~frink/chown/readme.html
  42. -   */
  43. -  (void)data;
  44. -  (void)thread;
  45. -#else
  46.     Eio_File_Chown *own = data;
  47.     char *tmp;
  48.     uid_t owner = -1;
  49. @@ -266,7 +260,6 @@ _eio_file_chown(void *data, Ecore_Thread *thread)
  50.   on_error:
  51.     ecore_thread_cancel(thread);
  52.     return;
  53. -#endif
  54.  }
  55.  
  56.  static void
  57. @@ -585,6 +578,7 @@ eio_file_chown(const char *path,
  58.            Eio_Error_Cb error_cb,
  59.            const void *data)
  60.  {
  61. +#ifdef HAVE_CHOWN
  62.     Eio_File_Chown *c = NULL;
  63.  
  64.     EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
  65. @@ -601,11 +595,21 @@ eio_file_chown(const char *path,
  66.     if (!eio_file_set(&c->common,
  67.              done_cb,
  68.              error_cb,
  69. -             data,
  70. +            data,
  71.              _eio_file_chown,
  72.              _eio_file_chown_done,
  73.              _eio_file_chown_error))
  74.       return NULL;
  75.  
  76.     return &c->common;
  77. +#else
  78. +   WRN("chown() not supported on this platform");
  79. +   return NULL;
  80. +   (void)path;
  81. +   (void)user;
  82. +   (void)group;
  83. +   (void)done_cb;
  84. +   (void)error_cb;
  85. +   (void)data;
  86. +#endif
  87.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top