- debug_printf("running applet %s\n", argv[0]);
-// FIXME: check NOEXEC bit, and EXEC if not set!
- run_applet_and_exit(argv[0], argv);
-// is it ok that run_applet_and_exit() does exit(), not _exit()?
-// NB: IIRC on NOMMU we are after _vfork_, not fork!
+ if (strchr(argv[0], '/') == NULL) {
+ const struct bb_applet *a = find_applet_by_name(argv[0]);
+ if (a) {
+ if (a->noexec) {
+ current_applet = a;
+ debug_printf_exec("running applet '%s'\n", argv[0]);
+// is it ok that run_current_applet_and_exit() does exit(), not _exit()?
+ run_current_applet_and_exit(argv);
+ }
+ /* re-exec ourselves with the new arguments */
+ debug_printf_exec("re-execing applet '%s'\n", argv[0]);
+ execvp(CONFIG_BUSYBOX_EXEC_PATH, argv);
+ /* If they called chroot or otherwise made the binary no longer
+ * executable, fall through */
+ }
+ }