diff options
author | Brad King <brad.king@kitware.com> | 2016-09-29 18:19:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-29 18:19:51 (GMT) |
commit | f9cab9e38df8adeac5f83f80722dedff25affdcd (patch) | |
tree | edb096f74dd246dc2fc7787bcecbbbbb1437e06a /Utilities/cmlibuv/src/unix | |
parent | 5d29506811c5b75ae48e12de6c317f6440874215 (diff) | |
parent | 66ac1febc41967599d5bdaab912d786879ce6813 (diff) | |
download | CMake-f9cab9e38df8adeac5f83f80722dedff25affdcd.zip CMake-f9cab9e38df8adeac5f83f80722dedff25affdcd.tar.gz CMake-f9cab9e38df8adeac5f83f80722dedff25affdcd.tar.bz2 |
Merge branch 'upstream-libuv' into update-libuv
* upstream-libuv:
libuv 2016-09-27 (8221f9b3)
Diffstat (limited to 'Utilities/cmlibuv/src/unix')
-rw-r--r-- | Utilities/cmlibuv/src/unix/fs.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c index 216ef97..3d478b7 100644 --- a/Utilities/cmlibuv/src/unix/fs.c +++ b/Utilities/cmlibuv/src/unix/fs.c @@ -346,22 +346,30 @@ done: } -#if defined(__OpenBSD__) || (defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_8)) -static int uv__fs_scandir_filter(uv__dirent_t* dent) { +#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_8) +#define UV_CONST_DIRENT uv__dirent_t #else -static int uv__fs_scandir_filter(const uv__dirent_t* dent) { +#define UV_CONST_DIRENT const uv__dirent_t #endif + + +static int uv__fs_scandir_filter(UV_CONST_DIRENT* dent) { return strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0; } +static int uv__fs_scandir_sort(UV_CONST_DIRENT** a, UV_CONST_DIRENT** b) { + return strcmp((*a)->d_name, (*b)->d_name); +} + + static ssize_t uv__fs_scandir(uv_fs_t* req) { uv__dirent_t **dents; int saved_errno; int n; dents = NULL; - n = scandir(req->path, &dents, uv__fs_scandir_filter, alphasort); + n = scandir(req->path, &dents, uv__fs_scandir_filter, uv__fs_scandir_sort); /* NOTE: We will use nbufs as an index field */ req->nbufs = 0; @@ -790,6 +798,7 @@ static void uv__to_stat(struct stat* src, uv_stat_t* dst) { dst->st_flags = 0; dst->st_gen = 0; #elif !defined(_AIX) && ( \ + defined(_GNU_SOURCE) || \ defined(_BSD_SOURCE) || \ defined(_SVID_SOURCE) || \ defined(_XOPEN_SOURCE) || \ |