aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-02-02 03:28:56 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-02-02 03:28:56 +0100
commitc71b469f5daceb717e31cc9ce46b0e058e2c57b6 (patch)
treeab428529615091f3d1759ad9fcd254f0cab46b19 /libbb
parent099e528919e2219772265e99ab8a43d188c1b8db (diff)
downloadbusybox-c71b469f5daceb717e31cc9ce46b0e058e2c57b6.tar.gz
libbb: make BB_EXECVP/LP try to exec real binary if there's no /proc/self/exe
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/execable.c10
-rw-r--r--libbb/vfork_daemon_rexec.c12
2 files changed, 11 insertions, 11 deletions
diff --git a/libbb/execable.c b/libbb/execable.c
index d37640007..178a00a5f 100644
--- a/libbb/execable.c
+++ b/libbb/execable.c
@@ -68,12 +68,12 @@ int FAST_FUNC exists_execable(const char *filename)
}
#if ENABLE_FEATURE_PREFER_APPLETS
-/* just like the real execvp, but try to launch an applet named 'file' first
- */
-int FAST_FUNC bb_execvp(const char *file, char *const argv[])
+/* just like the real execvp, but try to launch an applet named 'file' first */
+int FAST_FUNC BB_EXECVP(const char *file, char *const argv[])
{
- return execvp(find_applet_by_name(file) >= 0 ? bb_busybox_exec_path : file,
- argv);
+ if (find_applet_by_name(file) >= 0)
+ execvp(bb_busybox_exec_path, argv);
+ return execvp(file, argv);
}
#endif
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 5e0fb0d73..cb4781a59 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -182,17 +182,17 @@ int FAST_FUNC spawn_and_wait(char **argv)
int a = find_applet_by_name(argv[0]);
if (a >= 0 && (APPLET_IS_NOFORK(a)
-#if BB_MMU
+# if BB_MMU
|| APPLET_IS_NOEXEC(a) /* NOEXEC trick needs fork() */
-#endif
+# endif
)) {
-#if BB_MMU
+# if BB_MMU
if (APPLET_IS_NOFORK(a))
-#endif
+# endif
{
return run_nofork_applet(a, argv);
}
-#if BB_MMU
+# if BB_MMU
/* MMU only */
/* a->noexec is true */
rc = fork();
@@ -201,7 +201,7 @@ int FAST_FUNC spawn_and_wait(char **argv)
/* child */
xfunc_error_retval = EXIT_FAILURE;
run_applet_no_and_exit(a, argv);
-#endif
+# endif
}
#endif /* FEATURE_PREFER_APPLETS */
rc = spawn(argv);