From 9067f13be067f39f6c8586926b190b7dee0def3d Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 24 Mar 2007 12:11:17 +0000 Subject: NOMMU re-exec trick shuld not depend on existence of "don't daemonize" option for every affected applet (and dnsd, for example, don't have one). Thus rework re-exec support to not require it. Code got smaller too. --- applets/busybox.c | 7 +++++++ applets/individual.c | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'applets') diff --git a/applets/busybox.c b/applets/busybox.c index 0387d79b7..5334827ca 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -7,6 +7,7 @@ #include "busybox.h" const char *applet_name ATTRIBUTE_EXTERNALLY_VISIBLE; +smallint re_execed; #ifdef CONFIG_FEATURE_INSTALLER /* @@ -59,6 +60,12 @@ int main(int argc, char **argv) { const char *s; + /* NOMMU re-exec trick sets high-order bit in first byte of name */ + if (argv[0][0] & 0x80) { + re_execed = 1; + argv[0][0] &= 0x7f; + } + applet_name = argv[0]; if (*applet_name == '-') applet_name++; diff --git a/applets/individual.c b/applets/individual.c index 072168352..1667f188b 100644 --- a/applets/individual.c +++ b/applets/individual.c @@ -9,12 +9,11 @@ const char *applet_name; #include #include -//Ok to remove? #include "bb_config.h" #include "usage.h" int main(int argc, char *argv[]) { - applet_name=argv[0]; + applet_name = argv[0]; return APPLET_main(argc,argv); } -- cgit v1.2.3