[PATCH v3 08/27] script: replace execl call with BB_EXECVP
Nadav Tasher
tashernadav at gmail.com
Mon Jan 27 00:04:19 UTC 2025
Allows for more control over executed processes,
reduces code duplication by using BB_EXECVP_or_die.
Signed-off-by: Nadav Tasher <tashernadav at gmail.com>
---
util-linux/script.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/util-linux/script.c b/util-linux/script.c
index 58b844e77..46a038c1d 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -69,6 +69,7 @@ int script_main(int argc UNUSED_PARAM, char **argv)
OPT_q = (1 << 3),
OPT_t = (1 << 4),
};
+ char* shell_argv[4];
#if ENABLE_LONG_OPTS
static const char script_longopts[] ALIGN1 =
@@ -235,6 +236,9 @@ int script_main(int argc UNUSED_PARAM, char **argv)
/* Non-ignored signals revert to SIG_DFL on exec anyway */
/*signal(SIGCHLD, SIG_DFL);*/
- execl(shell, shell, shell_opt, shell_arg, (char *) NULL);
- bb_simple_perror_msg_and_die(shell);
+ shell_argv[0] = (char *) shell;
+ shell_argv[1] = shell_opt;
+ shell_argv[2] = shell_arg;
+ shell_argv[3] = NULL;
+ BB_EXECVP_or_die(shell_argv);
}
--
2.43.0
More information about the busybox
mailing list