summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger2016-01-13 13:30:20 -0500
committerMike Frysinger2016-01-13 13:30:20 -0500
commit6a70db85cfc2aba89fc23edf426a47630f497eb8 (patch)
tree4a22fe6e92a21daf3fc447a7c40156143313f4d0
parente111a1640494fe87fc913f94fae3bb805de0fc99 (diff)
downloadbusybox-6a70db85cfc2aba89fc23edf426a47630f497eb8.zip
busybox-6a70db85cfc2aba89fc23edf426a47630f497eb8.tar.gz
truncate: use O_WRONLY|O_NONBLOCK
This matches coreutils behavior. We don't read the fd, and truncation does not need blocking. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--coreutils/truncate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/coreutils/truncate.c b/coreutils/truncate.c
index 4c997bf..8d845f2 100644
--- a/coreutils/truncate.c
+++ b/coreutils/truncate.c
@@ -40,7 +40,7 @@ int truncate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int truncate_main(int argc UNUSED_PARAM, char **argv)
{
unsigned opts;
- int flags = O_RDWR;
+ int flags = O_WRONLY | O_NONBLOCK;
int ret = EXIT_SUCCESS;
char *size_str;
off_t size;