diff options
Diffstat (limited to 'coreutils/truncate.c')
-rw-r--r-- | coreutils/truncate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/truncate.c b/coreutils/truncate.c index e5fa656c8..8d845f218 100644 --- a/coreutils/truncate.c +++ b/coreutils/truncate.c | |||
@@ -40,7 +40,7 @@ int truncate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | |||
40 | int truncate_main(int argc UNUSED_PARAM, char **argv) | 40 | int truncate_main(int argc UNUSED_PARAM, char **argv) |
41 | { | 41 | { |
42 | unsigned opts; | 42 | unsigned opts; |
43 | int flags = O_RDWR; | 43 | int flags = O_WRONLY | O_NONBLOCK; |
44 | int ret = EXIT_SUCCESS; | 44 | int ret = EXIT_SUCCESS; |
45 | char *size_str; | 45 | char *size_str; |
46 | off_t size; | 46 | off_t size; |
@@ -64,7 +64,7 @@ int truncate_main(int argc UNUSED_PARAM, char **argv) | |||
64 | 64 | ||
65 | argv += optind; | 65 | argv += optind; |
66 | while (*argv) { | 66 | while (*argv) { |
67 | int fd = open(*argv, flags); | 67 | int fd = open(*argv, flags, 0666); |
68 | if (fd < 0) { | 68 | if (fd < 0) { |
69 | if (errno != ENOENT || !(opts & OPT_NOCREATE)) { | 69 | if (errno != ENOENT || !(opts & OPT_NOCREATE)) { |
70 | bb_perror_msg("%s: open", *argv); | 70 | bb_perror_msg("%s: open", *argv); |