Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix to throw an ENOSYS error properly when fs.futimesSync() is invoke…

…d and HAVE_FUTIMES is false.
  • Loading branch information...
commit 99638c9637edc76f63ee4eb3efc4dc1f892a647d 1 parent 6f96e78
@shigeki authored
Showing with 11 additions and 2 deletions.
  1. +1 −1  src/node_file.cc
  2. +10 −1 test/simple/test-fs-utimes.js
View
2  src/node_file.cc
@@ -201,7 +201,7 @@ static void After(uv_fs_t *req) {
// This struct is only used on sync fs calls.
// For async calls FSReqWrap is used.
struct fs_req_wrap {
- fs_req_wrap() {}
+ fs_req_wrap() { req->path = NULL; }
~fs_req_wrap() { uv_fs_req_cleanup(&req); }
// Ensure that copy ctor and assignment operator are not used.
fs_req_wrap(const fs_req_wrap& req);
View
11 test/simple/test-fs-utimes.js
@@ -57,6 +57,12 @@ function runTests(atime, mtime, callback) {
fs.utimesSync(__filename, atime, mtime);
expect_ok('utimesSync', __filename, undefined, atime, mtime);
tests_run++;
+
+ if (is_windows) {
+ fd = fs.openSync(__filename, 'r+');
+ } else {
+ fd = fs.openSync(__filename, 'r');
+ }
// some systems don't have futimes
// if there's an error, it should be ENOSYS
@@ -87,6 +93,10 @@ function runTests(atime, mtime, callback) {
expect_errno('futimesSync', -1, err, 'EBADF');
tests_run++;
}
+ //
+ // test sync code paths at first
+ //
+ syncTests();
//
// test async code paths
@@ -109,7 +119,6 @@ function runTests(atime, mtime, callback) {
fs.futimes(-1, atime, mtime, function(err) {
expect_errno('futimes', -1, err, 'EBADF');
- syncTests();
callback();
});
tests_run++;
Please sign in to comment.
Something went wrong with that request. Please try again.