summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston2018-11-05 13:13:08 +0000
committerDenys Vlasenko2018-11-06 08:49:11 +0100
commit8767c12774d9392565f20d3ea4e28bb1b6075a31 (patch)
treebbafe8f27680733f1db7e83dd43d55e62c1437ef /shell
parent084bac472b02f307a093f56a262312accd6fb014 (diff)
downloadbusybox-8767c12774d9392565f20d3ea4e28bb1b6075a31.zip
busybox-8767c12774d9392565f20d3ea4e28bb1b6075a31.tar.gz
ash: minor fixes
Ensure that login_sh is initialised in procargs even when running an embedded script. The argc argument to ash_main isn't unused when embedded scripts are present. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 88f2b5b..90eaf6f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -14052,11 +14052,11 @@ procargs(char **argv)
int login_sh;
xargv = argv;
+ login_sh = xargv[0] && xargv[0][0] == '-';
#if NUM_SCRIPTS > 0
if (minusc)
goto setarg0;
#endif
- login_sh = xargv[0] && xargv[0][0] == '-';
arg0 = xargv[0];
/* if (xargv[0]) - mmm, this is always true! */
xargv++;
@@ -14164,7 +14164,11 @@ extern int etext();
* is used to figure out how far we had gotten.
*/
int ash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+#if NUM_SCRIPTS > 0
+int ash_main(int argc, char **argv)
+#else
int ash_main(int argc UNUSED_PARAM, char **argv)
+#endif
/* note: 'argc' is used only if embedded scripts are enabled */
{
volatile smallint state;