[git commit] truncate: use O_WRONLY|O_NONBLOCK

Mike Frysinger vapier at gentoo.org
Wed Jan 13 18:30:20 UTC 2016


commit: http://git.busybox.net/busybox/commit/?id=6a70db85cfc2aba89fc23edf426a47630f497eb8
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

This matches coreutils behavior.  We don't read the fd, and truncation
does not need blocking.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 coreutils/truncate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;


More information about the busybox-cvs mailing list