SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 59 in 3 days
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..a28f692492 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. @@ -297,6 +290,7 @@ _eio_file_chown_error(void *data, Ecore_Thread *thread EINA_UNUSED)
  58.     eio_file_error(&ch->common);
  59.     _eio_chown_free(ch);
  60.  }
  61. +#endif
  62.  
  63.  /**
  64.   * @endcond
  65. @@ -585,6 +579,7 @@ eio_file_chown(const char *path,
  66.            Eio_Error_Cb error_cb,
  67.            const void *data)
  68.  {
  69. +#ifdef HAVE_CHOWN
  70.     Eio_File_Chown *c = NULL;
  71.  
  72.     EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
  73. @@ -601,11 +596,21 @@ eio_file_chown(const char *path,
  74.     if (!eio_file_set(&c->common,
  75.              done_cb,
  76.              error_cb,
  77. -             data,
  78. +            data,
  79.              _eio_file_chown,
  80.              _eio_file_chown_done,
  81.              _eio_file_chown_error))
  82.       return NULL;
  83.  
  84.     return &c->common;
  85. +#else
  86. +   WRN("chown() not supported on this platform");
  87. +   return NULL;
  88. +   (void)path;
  89. +   (void)user;
  90. +   (void)group;
  91. +   (void)done_cb;
  92. +   (void)error_cb;
  93. +   (void)data;
  94. +#endif
  95.  }
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
 
Top