Allow fsync() to fail on special files

This commit is contained in:
Přemysl Eric Janouch 2016-01-26 21:35:45 +01:00
parent ce8703cea0
commit 052d2ffc9a
1 changed files with 2 additions and 1 deletions

View File

@ -3472,7 +3472,8 @@ write_file (const char *filename, const void *data, size_t data_len,
}
fwrite (data, data_len, 1, fp);
bool success = !ferror (fp) && !fflush (fp) && !fsync (fileno (fp));
bool success = !ferror (fp) && !fflush (fp)
&& (!fsync (fileno (fp)) || errno == EINVAL);
fclose (fp);
if (!success)