diff options
author | attilio <attilio@FreeBSD.org> | 2013-02-24 16:50:53 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-02-24 16:50:53 +0000 |
commit | cff31deb1a197b29ab976c135fdd01dfb6951a6a (patch) | |
tree | dbdcb15ce3419e48e823390b612d613ff00bd567 /sys/kern/vfs_syscalls.c | |
parent | b4e24f9126f7a4c80ce0c44f6b4230021089bc1e (diff) | |
parent | 084e5da56e3c4bc6f9c6ed314310a9b8af2c695b (diff) | |
download | FreeBSD-src-cff31deb1a197b29ab976c135fdd01dfb6951a6a.zip FreeBSD-src-cff31deb1a197b29ab976c135fdd01dfb6951a6a.tar.gz |
MFC
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index dd1232c..bbda70d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -980,7 +980,10 @@ flags_to_rights(int flags) if (flags & O_TRUNC) rights |= CAP_FTRUNCATE; - if ((flags & O_EXLOCK) || (flags & O_SHLOCK)) + if (flags & (O_SYNC | O_FSYNC)) + rights |= CAP_FSYNC; + + if (flags & (O_EXLOCK | O_SHLOCK)) rights |= CAP_FLOCK; return (rights); @@ -3265,8 +3268,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr, AUDIT_ARG_FD(fd); if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); - if ((error = getvnode(td->td_proc->p_fd, fd, CAP_FUTIMES, &fp)) - != 0) + if ((error = getvnode(td->td_proc->p_fd, fd, CAP_FUTIMES, &fp)) != 0) return (error); #ifdef AUDIT vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); @@ -3416,8 +3418,7 @@ sys_fsync(td, uap) int error, lock_flags; AUDIT_ARG_FD(uap->fd); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FSYNC, - &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_FSYNC, &fp)) != 0) return (error); vp = fp->f_vnode; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) @@ -3526,8 +3527,7 @@ kern_renameat(struct thread *td, int oldfd, char *old, int newfd, char *new, goto out1; } NDINIT_ATRIGHTS(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | - SAVESTART | AUDITVNODE2, pathseg, new, newfd, CAP_CREATE, - td); + SAVESTART | AUDITVNODE2, pathseg, new, newfd, CAP_CREATE, td); if (fromnd.ni_vp->v_type == VDIR) tond.ni_cnd.cn_flags |= WILLBEDIR; if ((error = namei(&tond)) != 0) { @@ -3826,8 +3826,7 @@ kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, /* XXX arbitrary sanity limit on `count'. */ if (uap->count > 64 * 1024) return (EINVAL); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_READ, - &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, uap->fd, CAP_READ, &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { fdrop(fp, td); @@ -4618,7 +4617,7 @@ kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, error = fget(td, fd, 0, &fp); if (error != 0) goto out; - + switch (fp->f_type) { case DTYPE_VNODE: break; |