From af8a7c13b516c77c1e6092157e23ca26db44b1af Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Sat, 12 Mar 2022 06:19:53 +0900 Subject: [PATCH] Cygwin: fsync: Return EINVAL for special files. - Unlike linux, fsync() calls FlushFileBuffers() even for special files. This causes the problem reported in: https://cygwin.com/pipermail/cygwin/2022-March/251022.html This patch fixes the issue. --- winsup/cygwin/fhandler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 98d7a3b2d..fc7bf0a0e 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1750,7 +1750,7 @@ fhandler_base::utimens (const struct timespec *tvp) int fhandler_base::fsync () { - if (!get_handle () || nohandle ()) + if (!get_handle () || nohandle () || pc.isspecial ()) { set_errno (EINVAL); return -1;