diff options
| author | Brian S. Dean <bsd@FreeBSD.org> | 2000-03-13 23:00:08 +0000 |
|---|---|---|
| committer | Brian S. Dean <bsd@FreeBSD.org> | 2000-03-13 23:00:08 +0000 |
| commit | 56fc73ff9bfe1a2c7d4b632e2804b80c06d4dcf3 (patch) | |
| tree | 857509333d1bd1120c3ac9a829de45f5cad893ab /sys/kern/sysv_ipc.c | |
| parent | c9b2af93fa7bfaf72c6396eb5a51c27dc1412669 (diff) | |
Notes
Diffstat (limited to 'sys/kern/sysv_ipc.c')
| -rw-r--r-- | sys/kern/sysv_ipc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c index 581043c6d117..9bea4976a2af 100644 --- a/sys/kern/sysv_ipc.c +++ b/sys/kern/sysv_ipc.c @@ -51,16 +51,11 @@ ipcperm(p, perm, mode) int mode; { struct ucred *cred = p->p_ucred; - int error; - - error = suser(p); - if (!error) - return (0); /* Check for user match. */ if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) { if (mode & IPC_M) - return (EPERM); + return (suser(p) == 0 ? 0 : EPERM); /* Check for group match. */ mode >>= 3; if (!groupmember(perm->gid, cred) && @@ -71,7 +66,7 @@ ipcperm(p, perm, mode) if (mode & IPC_M) return (0); - return ((mode & perm->mode) == mode ? 0 : EACCES); + return ((mode & perm->mode) == mode || suser(p) == 0 ? 0 : EACCES); } #endif /* defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG) */ |
