This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [1.7] bugs in faccessat
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Thu, 3 Sep 2009 15:18:56 -0400
- Subject: Re: [1.7] bugs in faccessat
- References: <loom.20090903T175736-252@post.gmane.org> <4AA01449.6060707@byu.net>
- Reply-to: cygwin-patches at cygwin dot com
On Thu, Sep 03, 2009 at 01:08:57PM -0600, Eric Blake wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>According to Eric Blake on 9/3/2009 9:58 AM:
>> faccessat has at least two, and probably three bugs.
>
>Here's a fix for 1 (typo) and 3 (check for EINVAL in more places), but not
>for 2 (euidaccess, and the followup request of lchmod).
>
>2009-09-03 Eric Blake <ebb9@byu.net>
>
> * syscalls.cc (faccessat): Fix typo, reject bad flags.
> (fchmodat, fchownat, fstatat, utimensat, linkat, unlinkat): Reject
> bad flags.
>
>diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
>index 3798587..6dee7d3 100644
>--- a/winsup/cygwin/syscalls.cc
>+++ b/winsup/cygwin/syscalls.cc
>@@ -3825,7 +3825,8 @@ faccessat (int dirfd, const char *pathname, int mode, int flags)
> char *path = tp.c_get ();
> if (!gen_full_path_at (path, dirfd, pathname))
> {
>- if (flags & ~(F_OK|R_OK|W_OK|X_OK))
>+ if ((mode & ~(F_OK|R_OK|W_OK|X_OK))
>+ || (flags & ~(AT_SYMLINK_NOFOLLOW|AT_EACCESS)))
It's hard to tell from the patch. Is this properly aligned? The || should be under the
(mode.
With that minor comment please check in.
Thanks.
cgf