public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH v2] Cygwin: fsync: Fix EINVAL for block device.
@ 2023-01-22  0:08 Takashi Yano
  2023-01-22  9:01 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Takashi Yano @ 2023-01-22  0:08 UTC (permalink / raw)
  To: cygwin-patches; +Cc: Takashi Yano, Yano Ray, Corinna Vinschen

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 <yanorei@hotmail.co.jp>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
 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 b2738cf20..9b49ec7b9 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 000000000..c1476ff46
--- /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
-- 
2.39.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Cygwin: fsync: Fix EINVAL for block device.
  2023-01-22  0:08 [PATCH v2] Cygwin: fsync: Fix EINVAL for block device Takashi Yano
@ 2023-01-22  9:01 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2023-01-22  9:01 UTC (permalink / raw)
  To: cygwin-patches

On Jan 22 09:08, Takashi Yano wrote:
> 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 <yanorei@hotmail.co.jp>
> Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
> ---
>  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

Thanks, please push.


Corinna

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-22  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-22  0:08 [PATCH v2] Cygwin: fsync: Fix EINVAL for block device Takashi Yano
2023-01-22  9:01 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).