public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: fhandler_base::fstat_fs: accomodate the O_PATH flag
Date: Tue, 28 Jan 2020 19:06:00 -0000 [thread overview]
Message-ID: <20200128190641.130685.qmail@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=74e6e881433c45e758582adfdcb4be20ad5b52a9
commit 74e6e881433c45e758582adfdcb4be20ad5b52a9
Author: Ken Brown <kbrown@cornell.edu>
Date: Fri Jan 24 14:54:47 2020 -0500
Cygwin: fhandler_base::fstat_fs: accomodate the O_PATH flag
Treat a special file opened with O_PATH the same as a regular file,
i.e., use its handle to get the stat information.
Before this change, fstat_fs opened the file a second time, with the
wrong flags and without closing the existing handle. A side effect
was to change the openflags of the file, possibly causing further
system calls to fail.
Currently this change only affects FIFOs, but it will affect
AF_LOCAL/AF_UNIX sockets too once they support O_PATH.
Diff:
---
winsup/cygwin/fhandler_disk_file.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 197f04f..d9213d7 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -359,7 +359,7 @@ fhandler_base::fstat_fs (struct stat *buf)
if (get_stat_handle ())
{
- if (!nohandle () && !is_fs_special ())
+ if (!nohandle () && (!is_fs_special () || get_flags () & O_PATH))
res = pc.fs_is_nfs () ? fstat_by_nfs_ea (buf) : fstat_by_handle (buf);
if (res)
res = fstat_by_name (buf);
reply other threads:[~2020-01-28 19:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200128190641.130685.qmail@sourceware.org \
--to=kbrown@sourceware.org \
--cc=cygwin-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).