[PATCH] ash: minor fixes

Denys Vlasenko vda.linux at googlemail.com
Tue Nov 6 07:50:07 UTC 2018


Applied, thanks!
On Mon, Nov 5, 2018 at 2:13 PM Ron Yorston <rmy at pobox.com> wrote:
>
> 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 at pobox.com>
> ---
>  shell/ash.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/shell/ash.c b/shell/ash.c
> index 88f2b5bd6..90eaf6faf 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;
> --
> 2.19.1
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox


More information about the busybox mailing list