[git commit] time: fix build for toolchains without O_CLOEXEC
Denys Vlasenko
vda.linux at googlemail.com
Fri Oct 27 17:05:00 UTC 2017
commit: https://git.busybox.net/busybox/commit/?id=d3a7e88008880489feb0f0adf1bcf8af1af2e9a7
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
Based on patch by Eugene Rudoy <gene.devel at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
miscutils/time.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/miscutils/time.c b/miscutils/time.c
index f4f8149..61f0787 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -442,11 +442,16 @@ int time_main(int argc UNUSED_PARAM, char **argv)
output_format = posix_format;
output_fd = STDERR_FILENO;
if (opt & OPT_o) {
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
output_fd = xopen(output_filename,
(opt & OPT_a) /* append? */
? (O_CREAT | O_WRONLY | O_CLOEXEC | O_APPEND)
: (O_CREAT | O_WRONLY | O_CLOEXEC | O_TRUNC)
);
+ if (!O_CLOEXEC)
+ close_on_exec_on(output_fd);
}
run_command(argv, &res);
More information about the busybox-cvs
mailing list