From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 17E57385E012; Mon, 14 Mar 2022 10:40:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17E57385E012 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: Return EINVAL for special files. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/master X-Git-Oldrev: b2d4dc167cf9ffd992d88e23dc1d3debadcc2c4b X-Git-Newrev: af8a7c13b516c77c1e6092157e23ca26db44b1af Message-Id: <20220314104019.17E57385E012@sourceware.org> Date: Mon, 14 Mar 2022 10:40:19 +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:40:19 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Daf8a7c13b51= 6c77c1e6092157e23ca26db44b1af commit af8a7c13b516c77c1e6092157e23ca26db44b1af 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;