aboutsummaryrefslogtreecommitdiff
path: root/libbb/executable.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-04-04 16:22:54 +0100
committerRon Yorston <rmy@pobox.com>2016-04-04 16:22:54 +0100
commit253dbd612b2d2f041f4263e15a3b94df70f41e36 (patch)
treef6c6e12a0541233058a7f7ccb1251afeb457da06 /libbb/executable.c
parent3cf56a021d7a62512b477640e930e1a78288075c (diff)
parentd7d4750e1e213e7448147186dddfe3bfbb47eea0 (diff)
downloadbusybox-w32-253dbd612b2d2f041f4263e15a3b94df70f41e36.tar.gz
busybox-w32-253dbd612b2d2f041f4263e15a3b94df70f41e36.tar.bz2
busybox-w32-253dbd612b2d2f041f4263e15a3b94df70f41e36.zip
Merge branch 'busybox' into merge
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}