From 17ad18afc62ceefe01273e4c2fff9114275ab909 Mon Sep 17 00:00:00 2001 From: Takashi Yano Date: Sat, 21 Jan 2023 21:33:03 +0900 Subject: Cygwin: fsync: Fix EINVAL for block device. The commit af8a7c13b516 has a problem that fsync returns EINVAL for block device. This patch treats block devices as a special case. https://cygwin.com/pipermail/cygwin/2023-January/252916.html Fixes: af8a7c13b516 ("Cygwin: fsync: Return EINVAL for special files.") Reported-by: Yano Ray Reviewed-by: Corinna Vinschen Signed-off-by: Takashi Yano --- winsup/cygwin/fhandler/base.cc | 3 ++- winsup/cygwin/release/3.4.6 | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 winsup/cygwin/release/3.4.6 diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc index b2738cf..9b49ec7 100644 --- a/winsup/cygwin/fhandler/base.cc +++ b/winsup/cygwin/fhandler/base.cc @@ -1728,7 +1728,8 @@ fhandler_base::utimens (const struct timespec *tvp) int fhandler_base::fsync () { - if (!get_handle () || nohandle () || pc.isspecial ()) + if (!get_handle () || nohandle () + || (pc.isspecial () && !S_ISBLK (pc.dev.mode ()))) { set_errno (EINVAL); return -1; diff --git a/winsup/cygwin/release/3.4.6 b/winsup/cygwin/release/3.4.6 new file mode 100644 index 0000000..c1476ff --- /dev/null +++ b/winsup/cygwin/release/3.4.6 @@ -0,0 +1,5 @@ +Bug Fixes +--------- + +Fix a problem that fsync returns EINVAL for block device. +Addresses: https://cygwin.com/pipermail/cygwin/2023-January/252916.html -- cgit v1.1