aboutsummaryrefslogtreecommitdiff
path: root/libbb/executable.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/executable.c')
-rw-r--r--libbb/executable.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/executable.c b/libbb/executable.c
index 12a48cea3..308c525a3 100644
--- a/libbb/executable.c
+++ b/libbb/executable.c
@@ -97,10 +97,19 @@ int FAST_FUNC BB_EXECVP(const char *file, char *const argv[])
97} 97}
98#endif 98#endif
99 99
100int FAST_FUNC BB_EXECVP_or_die(char **argv) 100void FAST_FUNC BB_EXECVP_or_die(char **argv)
101{ 101{
102 BB_EXECVP(argv[0], argv); 102 BB_EXECVP(argv[0], argv);
103 /* SUSv3-mandated exit codes */ 103 /* SUSv3-mandated exit codes */
104 xfunc_error_retval = (errno == ENOENT) ? 127 : 126; 104 xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
105 bb_perror_msg_and_die("can't execute '%s'", argv[0]); 105 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
106} 106}
107
108/* Typical idiom for applets which exec *optional* PROG [ARGS] */
109void FAST_FUNC exec_prog_or_SHELL(char **argv)
110{
111 if (argv[0]) {
112 BB_EXECVP_or_die(argv);
113 }
114 run_shell(getenv("SHELL"), /*login:*/ 1, NULL, NULL);
115}