diff options
author | cjihrig <cjihrig@gmail.com> | 2019-04-15 11:28:16 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-04-22 12:04:35 -0400 |
commit | aec2ce4ee11c766d4c7fcc532f794a758404a6c7 (patch) | |
tree | 9426e0d8e92a314c6f23290a2939cd45c418cf3b /deps/uv/src/uv-common.c | |
parent | 2161690024862fbfc23c4e01d98199acb832f76b (diff) | |
download | android-node-v8-aec2ce4ee11c766d4c7fcc532f794a758404a6c7.tar.gz android-node-v8-aec2ce4ee11c766d4c7fcc532f794a758404a6c7.tar.bz2 android-node-v8-aec2ce4ee11c766d4c7fcc532f794a758404a6c7.zip |
deps: upgrade to libuv 1.28.0
Notable changes:
- uv_gettimeofday() has been added.
- Streaming readdir() via the uv_fs_{open,read,close}dir() methods.
- A macOS copyfile() permissions bug has been fixed.
- A bug in uv_interface_addresses() on machines with multiple
interfaces has been fixed.
Fixes: https://github.com/nodejs/node/issues/27273
PR-URL: https://github.com/nodejs/node/pull/27241
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/uv/src/uv-common.c')
-rw-r--r-- | deps/uv/src/uv-common.c | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c index 94dd59fb07..066eb31d03 100644 --- a/deps/uv/src/uv-common.c +++ b/deps/uv/src/uv-common.c @@ -34,6 +34,7 @@ # include <malloc.h> /* malloc */ #else # include <net/if.h> /* if_nametoindex */ +# include <sys/un.h> /* AF_UNIX, sockaddr_un */ #endif @@ -376,6 +377,10 @@ int uv__udp_check_before_send(uv_udp_t* handle, const struct sockaddr* addr) { addrlen = sizeof(struct sockaddr_in); else if (addr->sa_family == AF_INET6) addrlen = sizeof(struct sockaddr_in6); +#if defined(AF_UNIX) && !defined(_WIN32) + else if (addr->sa_family == AF_UNIX) + addrlen = sizeof(struct sockaddr_un); +#endif else return UV_EINVAL; } else { @@ -631,37 +636,66 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) { dent = dents[(*nbufs)++]; ent->name = dent->d_name; + ent->type = uv__fs_get_dirent_type(dent); + + return 0; +} + +uv_dirent_type_t uv__fs_get_dirent_type(uv__dirent_t* dent) { + uv_dirent_type_t type; + #ifdef HAVE_DIRENT_TYPES switch (dent->d_type) { case UV__DT_DIR: - ent->type = UV_DIRENT_DIR; + type = UV_DIRENT_DIR; break; case UV__DT_FILE: - ent->type = UV_DIRENT_FILE; + type = UV_DIRENT_FILE; break; case UV__DT_LINK: - ent->type = UV_DIRENT_LINK; + type = UV_DIRENT_LINK; break; case UV__DT_FIFO: - ent->type = UV_DIRENT_FIFO; + type = UV_DIRENT_FIFO; break; case UV__DT_SOCKET: - ent->type = UV_DIRENT_SOCKET; + type = UV_DIRENT_SOCKET; break; case UV__DT_CHAR: - ent->type = UV_DIRENT_CHAR; + type = UV_DIRENT_CHAR; break; case UV__DT_BLOCK: - ent->type = UV_DIRENT_BLOCK; + type = UV_DIRENT_BLOCK; break; default: - ent->type = UV_DIRENT_UNKNOWN; + type = UV_DIRENT_UNKNOWN; } #else - ent->type = UV_DIRENT_UNKNOWN; + type = UV_DIRENT_UNKNOWN; #endif - return 0; + return type; +} + +void uv__fs_readdir_cleanup(uv_fs_t* req) { + uv_dir_t* dir; + uv_dirent_t* dirents; + int i; + + if (req->ptr == NULL) + return; + + dir = req->ptr; + dirents = dir->dirents; + req->ptr = NULL; + + if (dirents == NULL) + return; + + for (i = 0; i < req->result; ++i) { + uv__free((char*) dirents[i].name); + dirents[i].name = NULL; + } } |