[Toybox] [PATCH] head: Fix not -123 options

Rob Landley rob at landley.net
Sat Mar 28 16:12:08 PDT 2015


On 03/28/2015 04:31 PM, Felix Janda wrote:
> ---
>  toys/posix/head.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/toys/posix/head.c b/toys/posix/head.c
> index 42f945b..8e77b01 100644
> --- a/toys/posix/head.c
> +++ b/toys/posix/head.c
> @@ -56,6 +56,7 @@ void head_main(void)
>    if (arg && *arg == '-' && arg[1]) {
>      TT.lines = atolx(arg+1);
>      toys.optc--;
> +    toys.optargs++;
>    }
> -  loopfiles(toys.optargs+!!arg, do_head);
> +  loopfiles(toys.optargs, do_head);
>  }

Actually I try to avoid modifying toys.optargs in case I expand nofork()
stuff in future and want to free it on return.

When you say "fix", could you give me a test case showing the failure?

Thanks,

Rob

 1427584328.0


More information about the Toybox mailing list