summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-11-18 06:59:59 +0000
committermillert <millert@openbsd.org>1997-11-18 06:59:59 +0000
commit76c72b105ae958fcbaebd64fdc7a54d4e9c99350 (patch)
treee16d90ae22d4059ad2635e34c4bec31a949f142a
parentFix misplace '>' vs. '>>'; John.P.Darrow@wheaton.edu (diff)
downloadwireguard-openbsd-76c72b105ae958fcbaebd64fdc7a54d4e9c99350.tar.xz
wireguard-openbsd-76c72b105ae958fcbaebd64fdc7a54d4e9c99350.zip
Use 0177777, not 07777 as the mask to check for EINVAL. This allows
one to use the st_mode field in struct stat as an argument to f?chmod().
-rw-r--r--sys/kern/vfs_syscalls.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index c73c3e1bd16..d444fea36e9 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.30 1997/11/17 07:46:24 deraadt Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.31 1997/11/18 06:59:59 millert Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1529,7 +1529,7 @@ sys_chmod(p, v, retval)
int error;
struct nameidata nd;
- if (SCARG(uap, mode) & ~ALLPERMS)
+ if (SCARG(uap, mode) & ~(S_IFMT | ALLPERMS))
return (EINVAL);
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
@@ -1568,7 +1568,7 @@ sys_fchmod(p, v, retval)
struct file *fp;
int error;
- if (SCARG(uap, mode) & ~ALLPERMS)
+ if (SCARG(uap, mode) & ~(S_IFMT | ALLPERMS))
return (EINVAL);
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)