From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id B5869385E02F; Mon, 14 Mar 2022 10:39:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5869385E02F 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-3_3-branch] Cygwin: fsync: Return EINVAL for special files. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 7dadbf800505a94079901370e737d3de28673c6e X-Git-Newrev: 85eb7125a65e7b62881c314b2ce59f8422dcc9ec Message-Id: <20220314103954.B5869385E02F@sourceware.org> Date: Mon, 14 Mar 2022 10:39:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2022 10:39:54 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D85eb7125a65= e7b62881c314b2ce59f8422dcc9ec commit 85eb7125a65e7b62881c314b2ce59f8422dcc9ec Author: Takashi Yano Date: Sat Mar 12 06:19:53 2022 +0900 Cygwin: fsync: Return EINVAL for special files. =20 - 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. Diff: --- 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;