Do not use O_CLOEXEC flags (available since 2.6.23),
use close_on_exec_on provided by libbb instead (like everywhere else)

Signed-off-by: Eugene Rudoy <[email protected]>
---
 miscutils/time.c          | 6 ++++--
 modutils/modprobe-small.c | 3 ++-
 modutils/modutils.c       | 3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/miscutils/time.c b/miscutils/time.c
index f4f8149d3..4f0e37d35 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -444,9 +444,11 @@ int time_main(int argc UNUSED_PARAM, char **argv)
        if (opt & OPT_o) {
                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)
+                       ? (O_CREAT | O_WRONLY | O_APPEND)
+                       : (O_CREAT | O_WRONLY | O_TRUNC)
                );
+               if (output_fd >= 0)
+                       close_on_exec_on(output_fd);
        }
 
        run_command(argv, &res);
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index a94b0b9a6..e782d687d 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -270,8 +270,9 @@ static int load_module(const char *fname, const char 
*options)
        r = 1;
 # ifdef __NR_finit_module
        {
-               int fd = open(fname, O_RDONLY | O_CLOEXEC);
+               int fd = open(fname, O_RDONLY);
                if (fd >= 0) {
+                       close_on_exec_on(fd);
                        r = finit_module(fd, options, 0) != 0;
                        close(fd);
                }
diff --git a/modutils/modutils.c b/modutils/modutils.c
index 6f7cd9721..9f73d676c 100644
--- a/modutils/modutils.c
+++ b/modutils/modutils.c
@@ -215,8 +215,9 @@ int FAST_FUNC bb_init_module(const char *filename, const 
char *options)
         */
 # ifdef __NR_finit_module
        {
-               int fd = open(filename, O_RDONLY | O_CLOEXEC);
+               int fd = open(filename, O_RDONLY);
                if (fd >= 0) {
+                       close_on_exec_on(fd);
                        rc = finit_module(fd, options, 0) != 0;
                        close(fd);
                        if (rc == 0)
-- 
2.14.2

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to