os/fileio: Allow certain failures during file_fsync

According to the documentation fsync() may fail with EROFS or EINVAL if “file 
descriptor is bound to a special file which does not support synchronization” 
(e.g. /dev/stderr). This condition is completely valid in this case since main 
point of `file_fsync()` is dumping buffered input.
This commit is contained in:
ZyX 2016-07-30 18:14:04 +03:00
parent 4a511de881
commit 85e1a56560

View File

@ -153,7 +153,11 @@ int file_fsync(FileDescriptor *const fp)
fp->_error = 0; fp->_error = 0;
return error; return error;
} }
return os_fsync(fp->fd); const int error = os_fsync(fp->fd);
if (error != UV_EINVAL && error != UV_EROFS) {
return error;
}
return 0;
} }
/// Buffer used for writing /// Buffer used for writing