Skip to content

Commit

Permalink
test: avoid running fsync on directory on AIX
Browse files Browse the repository at this point in the history
On AIX the underlying fsync system call returns EBADF on a file
descriptor for an open directory. So avoid running fsync on it.

PR-URL: #21298
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
jBarz authored and richardlau committed Jun 22, 2018
1 parent 49ea06f commit 8689c78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/parallel/test-fs-utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ function stat_resource(resource) {
if (typeof resource === 'string') {
return fs.statSync(resource);
} else {
const stats = fs.fstatSync(resource);
// ensure mtime has been written to disk
// except for directories on AIX where it cannot be synced
if (common.isAIX && stats.isDirectory())
return stats;
fs.fsyncSync(resource);
return fs.fstatSync(resource);
}
Expand Down

0 comments on commit 8689c78

Please sign in to comment.