diff options
author | pjd <pjd@FreeBSD.org> | 2013-03-16 23:19:13 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2013-03-16 23:19:13 +0000 |
commit | acae942b0530c6e423e597a93933d0dc4d59185a (patch) | |
tree | 7e6d274f3ed27f8d78f57a2561d677c6d08a17f0 /sys/kern/vfs_syscalls.c | |
parent | fc3188711fedd628497b6009ab648c191c72e603 (diff) | |
download | FreeBSD-src-acae942b0530c6e423e597a93933d0dc4d59185a.zip FreeBSD-src-acae942b0530c6e423e597a93933d0dc4d59185a.tar.gz |
Require CAP_SEEK if both O_APPEND and O_TRUNC flags are absent.
In other words we don't require CAP_SEEK if either O_APPEND or O_TRUNC flag is
given, because O_APPEND doesn't allow to overwrite existing data and O_TRUNC
requires CAP_FTRUNCATE already.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 401c21c..1c361bd 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -971,7 +971,7 @@ flags_to_rights(int flags) /* FALLTHROUGH */ case O_WRONLY: rights |= CAP_WRITE; - if (!(flags & O_APPEND)) + if (!(flags & (O_APPEND | O_TRUNC))) rights |= CAP_SEEK; break; } |