diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-27 19:05:00 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-10-27 19:05:00 +0200 |
commit | d3a7e88008880489feb0f0adf1bcf8af1af2e9a7 (patch) | |
tree | f7ff027c42cdffd10494bf202ecc42ddcf928d54 /miscutils | |
parent | 9ac42c500586fa5f10a1f6d22c3f797df11b1f6b (diff) | |
download | busybox-w32-d3a7e88008880489feb0f0adf1bcf8af1af2e9a7.tar.gz busybox-w32-d3a7e88008880489feb0f0adf1bcf8af1af2e9a7.tar.bz2 busybox-w32-d3a7e88008880489feb0f0adf1bcf8af1af2e9a7.zip |
time: fix build for toolchains without O_CLOEXEC
Based on patch by Eugene Rudoy <gene.devel@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/time.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/miscutils/time.c b/miscutils/time.c index f4f8149d3..61f078755 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -442,11 +442,16 @@ int time_main(int argc UNUSED_PARAM, char **argv) | |||
442 | output_format = posix_format; | 442 | output_format = posix_format; |
443 | output_fd = STDERR_FILENO; | 443 | output_fd = STDERR_FILENO; |
444 | if (opt & OPT_o) { | 444 | if (opt & OPT_o) { |
445 | #ifndef O_CLOEXEC | ||
446 | # define O_CLOEXEC 0 | ||
447 | #endif | ||
445 | output_fd = xopen(output_filename, | 448 | output_fd = xopen(output_filename, |
446 | (opt & OPT_a) /* append? */ | 449 | (opt & OPT_a) /* append? */ |
447 | ? (O_CREAT | O_WRONLY | O_CLOEXEC | O_APPEND) | 450 | ? (O_CREAT | O_WRONLY | O_CLOEXEC | O_APPEND) |
448 | : (O_CREAT | O_WRONLY | O_CLOEXEC | O_TRUNC) | 451 | : (O_CREAT | O_WRONLY | O_CLOEXEC | O_TRUNC) |
449 | ); | 452 | ); |
453 | if (!O_CLOEXEC) | ||
454 | close_on_exec_on(output_fd); | ||
450 | } | 455 | } |
451 | 456 | ||
452 | run_command(argv, &res); | 457 | run_command(argv, &res); |