diff options
author | Eric Blake <eblake@redhat.com> | 2009-09-22 16:13:53 +0400 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2009-09-22 16:13:53 +0400 |
commit | 74a67d01a5e523a6b865eeb2ae2abf6a91935c8c (patch) | |
tree | 62907327c985ece308a7c185948b51417e99076c /winsup/cygwin/syscalls.cc | |
parent | abe6b5a3e2c500b9f3dc15924281eee837cde789 (diff) |
Make *at functions more like Linux.
* syscalls.cc (faccessat): Fix typo, reject bad flags.
(fchmodat, fchownat, fstatat, utimensat, linkat, unlinkat): Reject
bad flags.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 02a49b852..542a122d7 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -3851,7 +3851,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))) set_errno (EINVAL); else { @@ -3877,6 +3878,11 @@ fchmodat (int dirfd, const char *pathname, mode_t mode, int flags) myfault efault; if (efault.faulted (EFAULT)) return -1; + if (flags & ~AT_SYMLINK_NOFOLLOW) + { + set_errno (EINVAL); + return -1; + } char *path = tp.c_get (); if (gen_full_path_at (path, dirfd, pathname)) return -1; @@ -3891,6 +3897,11 @@ fchownat (int dirfd, const char *pathname, __uid32_t uid, __gid32_t gid, myfault efault; if (efault.faulted (EFAULT)) return -1; + if (flags & ~AT_SYMLINK_NOFOLLOW) + { + set_errno (EINVAL); + return -1; + } char *path = tp.c_get (); if (gen_full_path_at (path, dirfd, pathname)) return -1; @@ -3905,6 +3916,11 @@ fstatat (int dirfd, const char *pathname, struct __stat64 *st, int flags) myfault efault; if (efault.faulted (EFAULT)) return -1; + if (flags & ~AT_SYMLINK_NOFOLLOW) + { + set_errno (EINVAL); + return -1; + } char *path = tp.c_get (); if (gen_full_path_at (path, dirfd, pathname)) return -1; @@ -3922,6 +3938,11 @@ utimensat (int dirfd, const char *pathname, const struct timespec *times, if (efault.faulted (EFAULT)) return -1; char *path = tp.c_get (); + if (flags & ~AT_SYMLINK_NOFOLLOW) + { + set_errno (EINVAL); + return -1; + } if (gen_full_path_at (path, dirfd, pathname)) return -1; path_conv win32 (path, PC_POSIX | ((flags & AT_SYMLINK_NOFOLLOW) @@ -3952,6 +3973,11 @@ linkat (int olddirfd, const char *oldpathname, myfault efault; if (efault.faulted (EFAULT)) return -1; + if (flags & ~AT_SYMLINK_FOLLOW) + { + set_errno (EINVAL); + return -1; + } char *oldpath = tp.c_get (); if (gen_full_path_at (oldpath, olddirfd, oldpathname)) return -1; @@ -4060,6 +4086,11 @@ unlinkat (int dirfd, const char *pathname, int flags) myfault efault; if (efault.faulted (EFAULT)) return -1; + if (flags & ~AT_REMOVEDIR) + { + set_errno (EINVAL); + return -1; + } char *path = tp.c_get (); if (gen_full_path_at (path, dirfd, pathname)) return -1; |