summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-11 10:06:26 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-11 10:06:26 +0000
commit15cb4a42724e480734157a55921ba435ed1413fc (patch)
tree81648e3f71bad18e88e19cb8efe094a10d94ab15
parent9b49a5ed8551e46892af3f676e5d96d21b540e3c (diff)
fix a problem with two different applet_name's
-rw-r--r--include/busybox.h2
-rw-r--r--libbb/appletlib.c5
-rwxr-xr-xscripts/trylink6
3 files changed, 6 insertions, 7 deletions
diff --git a/include/busybox.h b/include/busybox.h
index 5c01eca8d..7ef36901a 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -56,7 +56,7 @@ extern const unsigned short NUM_APPLETS;
/* Length of these names has effect on size of libbusybox
* and "individual" binaries. Keep them short.
*/
-void lbb_prepare(char **argv) MAIN_EXTERNALLY_VISIBLE;
+void lbb_prepare(const char *applet, char **argv) MAIN_EXTERNALLY_VISIBLE;
#if ENABLE_BUILD_LIBBUSYBOX
#if ENABLE_FEATURE_SHARED_BUSYBOX
int lbb_main(int argc, char **argv) EXTERNALLY_VISIBLE;
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 953f1e7e5..8b1ed8000 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -127,11 +127,12 @@ const struct bb_applet *find_applet_by_name(const char *name)
int *const bb_errno __attribute__ ((section (".data")));
#endif
-void lbb_prepare(char **argv)
+void lbb_prepare(const char *applet, char **argv)
{
#ifdef __GLIBC__
(*(int **)&bb_errno) = __errno_location();
#endif
+ applet_name = applet;
/* Set locale for everybody except 'init' */
if (ENABLE_LOCALE_SUPPORT && getpid() != 1)
@@ -666,7 +667,7 @@ int lbb_main(int argc, char **argv)
int main(int argc, char **argv)
#endif
{
- lbb_prepare(argv);
+ lbb_prepare("busybox", argv);
#if !BB_MMU
/* NOMMU re-exec trick sets high-order bit in first byte of name */
diff --git a/scripts/trylink b/scripts/trylink
index 25629aa1a..7fe262baa 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -220,14 +220,12 @@ if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
while read name main junk; do
echo "\
-void lbb_prepare(char **argv);
+void lbb_prepare(const char *applet, char **argv);
int $main(int argc, char **argv);
-const char *applet_name = \"$name\";
-
int main(int argc, char **argv)
{
- lbb_prepare(argv);
+ lbb_prepare(\"$name\", argv);
return $main(argc, argv);
}
" >"$sharedlib_dir/applet.c"