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: fstatat: call fstat64 instead of fstat Date: Wed, 13 Jan 2021 13:14:16 +0000 (GMT) [thread overview] Message-ID: <20210113131416.2BA44383F850@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9ad86f619c44f612d6eb14c8b3fe76096cbbe645 commit 9ad86f619c44f612d6eb14c8b3fe76096cbbe645 Author: Ken Brown <kbrown@cornell.edu> Date: Tue Jan 12 14:18:28 2021 -0500 Cygwin: fstatat: call fstat64 instead of fstat This fixes a bug on 32-bit Cygwin that was introduced in commit 84252946, "Cygwin: fstatat, fchownat: support the AT_EMPTY_PATH flag". Add a comment explaining why fstat should not be called. Addresses: https://cygwin.com/pipermail/cygwin/2021-January/247399.html Diff: --- winsup/cygwin/release/3.2.0 | 3 +++ winsup/cygwin/syscalls.cc | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/release/3.2.0 b/winsup/cygwin/release/3.2.0 index 22f78e7a7..132d5c810 100644 --- a/winsup/cygwin/release/3.2.0 +++ b/winsup/cygwin/release/3.2.0 @@ -42,3 +42,6 @@ Bug Fixes - Fix return value of sqrtl on negative infinity. Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html + +- Fix a bug in fstatat(2) on 32 bit that could cause it to return garbage. + Addresses: https://cygwin.com/pipermail/cygwin/2021-January/247399.html diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 885ca375a..525efecf3 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1929,6 +1929,9 @@ _fstat64_r (struct _reent *ptr, int fd, struct stat *buf) } #ifdef __i386__ +/* This entry point is retained only to serve old 32 bit applications +built under Cygwin 1.3.x or earlier. Newer 32 bit apps are redirected +to fstat64; see NEW_FUNCTIONS in Makefile.in. */ extern "C" int fstat (int fd, struct stat *buf) { @@ -4852,7 +4855,7 @@ fstatat (int dirfd, const char *__restrict pathname, struct stat *__restrict st, cwdstuff::cwd_lock.release (); } else - return fstat (dirfd, st); + return fstat64 (dirfd, st); } path_conv pc (path, ((flags & AT_SYMLINK_NOFOLLOW) ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW)
reply other threads:[~2021-01-13 13:14 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=20210113131416.2BA44383F850@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: linkBe 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).