diff --git a/include/uv-private/uv-unix.h b/include/uv-private/uv-unix.h index 74b4e81a..fe32c4b8 100644 --- a/include/uv-private/uv-unix.h +++ b/include/uv-private/uv-unix.h @@ -295,7 +295,6 @@ typedef struct { double atime; \ double mtime; \ struct uv__work work_req; \ - struct stat statbuf; \ #define UV_WORK_PRIVATE_FIELDS \ struct uv__work work_req; diff --git a/include/uv-private/uv-win.h b/include/uv-private/uv-win.h index ef58401d..876b1312 100644 --- a/include/uv-private/uv-win.h +++ b/include/uv-private/uv-win.h @@ -555,7 +555,6 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s); size_t length; \ int64_t offset; \ }; \ - struct _stati64 stat; \ struct { \ double atime; \ double mtime; \ diff --git a/include/uv.h b/include/uv.h index 8ec4c623..249952fc 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1515,6 +1515,7 @@ struct uv_fs_s { void* ptr; const char* path; uv_err_code errorno; + uv_statbuf_t statbuf; /* Stores the result of uv_fs_stat and uv_fs_fstat. */ UV_FS_PRIVATE_FIELDS }; diff --git a/src/fs-poll.c b/src/fs-poll.c index 8d736cab..ad27f184 100644 --- a/src/fs-poll.c +++ b/src/fs-poll.c @@ -158,7 +158,7 @@ static void poll_cb(uv_fs_t* req) { goto out; } - statbuf = req->ptr; + statbuf = &req->statbuf; if (ctx->busy_polling != 0) if (ctx->busy_polling < 0 || !statbuf_eq(&ctx->statbuf, statbuf)) diff --git a/src/win/fs.c b/src/win/fs.c index 9b920c81..60e67a41 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -889,7 +889,7 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { return; } - if (fs__stat_handle(handle, &req->stat) != 0) { + if (fs__stat_handle(handle, &req->statbuf) != 0) { DWORD error = GetLastError(); if (do_lstat && error == ERROR_SYMLINK_NOT_SUPPORTED) { /* We opened a reparse point but it was not a symlink. Try again. */ @@ -904,7 +904,7 @@ INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { return; } - req->ptr = &req->stat; + req->ptr = &req->statbuf; req->result = 0; CloseHandle(handle); } @@ -935,12 +935,12 @@ static void fs__fstat(uv_fs_t* req) { return; } - if (fs__stat_handle(handle, &req->stat) != 0) { + if (fs__stat_handle(handle, &req->statbuf) != 0) { SET_REQ_WIN32_ERROR(req, GetLastError()); return; } - req->ptr = &req->stat; + req->ptr = &req->statbuf; req->result = 0; } diff --git a/test/test-fs.c b/test/test-fs.c index ddc3c73b..0016b3be 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -107,13 +107,13 @@ static char test_buf[] = "test-buffer\n"; static void check_permission(const char* filename, int mode) { int r; uv_fs_t req; - struct stat* s; + uv_statbuf_t* s; r = uv_fs_stat(uv_default_loop(), &req, filename, NULL); ASSERT(r == 0); ASSERT(req.result == 0); - s = req.ptr; + s = &req.statbuf; #ifdef _WIN32 /* * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit, @@ -543,7 +543,7 @@ TEST_IMPL(fs_file_loop) { } static void check_utime(const char* path, double atime, double mtime) { - struct stat* s; + uv_statbuf_t* s; uv_fs_t req; int r; @@ -551,7 +551,7 @@ static void check_utime(const char* path, double atime, double mtime) { ASSERT(r == 0); ASSERT(req.result == 0); - s = req.ptr; + s = &req.statbuf; #if defined(_WIN32) || defined(_AIX) ASSERT(s->st_atime == atime);