Fri Sep 25 08:35:00 GMT 2009
On Sep 24 21:40, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Followup to my faccessat patch. Here's several functions exported by
> Linux which are trivial to support in cygwin, and which coreutils would
> like to use. POSIX allows us to copy Linux' behavior about refusing to
> implement fchmodat(,AT_SYMLINK_NOFOLLOW) (aka BSD lchmod), so if/until we
> implement lchmod, we should not mistakenly change the permissions on the
> file the symlink is pointing to. I've also posted a newlib patch to
> declare e[uid]access.
> 2009-09-24 Eric Blake <email@example.com>
> * syscalls.cc (fchownat): lchmod is not yet implemented.
> (euidaccess): New function.
> * path.cc (realpath): Update comment.
> (canonicalize_file_name): New function.
> * include/cygwin/stdlib.h (canonicalize_file_name): Declare it.
> * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
> * cygwin.din: Export canonicalize_file_name, eaccess, euidaccess.
> * posix.sgml: Mention them.
This is basically ok since it doesn't change any existing functionality
anyway. Three points:
- Could you please add a patch to winsup/doc/new-features.sgml as
well, adding the new entry points to the "other new APIs" paragraph in
the file access related section?
- Please add the year 2008 to the copyright dates of include/cygwin/stdlib.h.
Another one I forgot back then. Thanks.
> @@ -3880,9 +3888,13 @@ fchmodat (int dirfd, const char *pathname, mode_t mode, int flags)
> myfault efault;
> if (efault.faulted (EFAULT))
> return -1;
> - if (flags & ~AT_SYMLINK_NOFOLLOW)
> + if (flags)
> - set_errno (EINVAL);
> + /* BSD has lchmod, but Linux does not. POSIX says
> + AT_SYMLINK_NOFOLLOW is allowed to fail with EOPNOTSUPP, but
> + only if pathname was a symlink; but Linux blindly fails with
> + ENOTSUP even for non-symlinks. */
> + set_errno ((flags & ~AT_SYMLINK_NOFOLLOW) ? EINVAL : ENOTSUP);
> return -1;
- Please use EOPNOTSUPP, rather than ENOTSUP. Linux doesn't actually
have ENOTSUP. It defines ENOTSUP == EOPNOTSUPP, see
/usr/include/bits/errno.h. The comment can simply refer to POSIX
instead of to Linux.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
More information about the Cygwin-patches