Skip to content

Commit

Permalink
tests,aix: avoid running fsync on directory
Browse files Browse the repository at this point in the history
The underlying fsync system call returns EBADF on a file descriptor
for an open directory. So avoid running fsync on it.
  • Loading branch information
jBarz committed Jun 13, 2018
1 parent 06cab45 commit d28958a
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 d28958a

Please sign in to comment.