aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-26 21:35:45 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-26 21:35:45 +0100
commit052d2ffc9a3141ef2bb771f70190ed7a0bb9da44 (patch)
treedc1b292be032ee1dc06d4513630e993371a650cf
parentce8703cea0e78fd62b9279e0cffbff2b5f2372ef (diff)
downloadliberty-052d2ffc9a3141ef2bb771f70190ed7a0bb9da44.tar.gz
liberty-052d2ffc9a3141ef2bb771f70190ed7a0bb9da44.tar.xz
liberty-052d2ffc9a3141ef2bb771f70190ed7a0bb9da44.zip
Allow fsync() to fail on special files
-rw-r--r--liberty.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/liberty.c b/liberty.c
index e61d9cd..7e3c615 100644
--- a/liberty.c
+++ b/liberty.c
@@ -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)