From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 837D33858D32; Sun, 22 Jan 2023 10:02:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 837D33858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674381726; bh=bQQy+9wuvmFsA9dGP7wkr6gj88oxJ3EX/2tyY1MMu5o=; h=From:To:Subject:Date:From; b=mXSmmxzFzgktXIN8M4Jj/oCvMbl44vYF6wj6umu9D4ps4205goqxgr2lJC2H9ze7b zsxXqoaRuzLqP+DSG+yocGK0ujrGGCliw+GChJUHWNEP7EVeQUTb4sZzelulmDDk5/ ry9g4qa6voRqD6of0wpV2UU+kvO6F+PWpSpDXxHs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: fsync: Fix EINVAL for block device. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: 3123fdeecb5aea4947cb720e52f0a32553751bb4 X-Git-Newrev: bdb9f5b17339b0d54e408c6d7999e3f387eea6cf Message-Id: <20230122100206.837D33858D32@sourceware.org> Date: Sun, 22 Jan 2023 10:02:06 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dbdb9f5b1733= 9b0d54e408c6d7999e3f387eea6cf commit bdb9f5b17339b0d54e408c6d7999e3f387eea6cf Author: Takashi Yano Date: Sat Jan 21 21:33:03 2023 +0900 Cygwin: fsync: Fix EINVAL for block device. =20 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 =20 Fixes: af8a7c13b516 ("Cygwin: fsync: Return EINVAL for special files.") Reported-by: Yano Ray Reviewed-by: Corinna Vinschen Signed-off-by: Takashi Yano Diff: --- winsup/cygwin/fhandler/base.cc | 3 ++- winsup/cygwin/release/3.4.6 | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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