Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update libuv to cfa4112950b1f897fda7

  • Loading branch information...
commit 319580953d69819e07b1162dd6dee218d0d5bb95 1 parent 232e8e1
Igor Zinkovsky authored
Showing with 23 additions and 1 deletion.
  1. +23 −1 deps/uv/src/win/fs.c
View
24 deps/uv/src/win/fs.c
@@ -491,14 +491,36 @@ void fs__readdir(uv_fs_t* req, const wchar_t* path, int flags) {
void fs__stat(uv_fs_t* req, const wchar_t* path) {
int result;
+ unsigned short mode;
- result = _wstati64(path, &req->stat);
+ fs__open(req, path, _O_RDONLY, 0);
+ if (req->result == -1) {
+ return;
+ }
+
+ result = _fstati64(req->result, &req->stat);
if (result == -1) {
req->ptr = NULL;
} else {
+
+ /*
+ * VC CRT doesn't properly set S_IFDIR in _fstati64,
+ * so we set it here if path is a directory.
+ */
+ if (GetFileAttributesW(path) & FILE_ATTRIBUTE_DIRECTORY) {
+ mode = req->stat.st_mode;
+ mode &= ~_S_IFMT;
+ mode |= _S_IFDIR;
+
+ req->stat.st_mode = mode;
+ assert((req->stat.st_mode & _S_IFMT) == _S_IFDIR);
+ }
+
req->ptr = &req->stat;
}
+ _close(req->result);
+
SET_REQ_RESULT(req, result);
}
Please sign in to comment.
Something went wrong with that request. Please try again.