From 052d2ffc9a3141ef2bb771f70190ed7a0bb9da44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Tue, 26 Jan 2016 21:35:45 +0100
Subject: [PATCH] Allow fsync() to fail on special files
---
liberty.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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)