[Toybox] [PATCH] fix ps.c build

Isaac Dunham ibid.ag at gmail.com
Sat Apr 18 18:48:14 PDT 2015


On Sat, Apr 18, 2015 at 01:43:00PM -0700, enh wrote:
> Fix ps.c build.
> 
> external/toybox/toys/pending/ps.c:315:21: error: address of array
> 'field->title' will always evaluate to 'true'
> [-Werror,-Wpointer-bool-conversion]
>         if (!field->title) strcpy(field->title, typos[field->which]);
>             ~~~~~~~~^~~~~
> 
> diff --git a/toys/pending/ps.c b/toys/pending/ps.c
> index cb0f32c..29111d5 100644
> --- a/toys/pending/ps.c
> +++ b/toys/pending/ps.c
> @@ -312,7 +312,7 @@ void ps_main(void)
>            if (j!=2) break;
>          }
>          if (i == ARRAY_LEN(typos)) error_exit("bad -o %.*s", end-type, type);
> -        if (!field->title) strcpy(field->title, typos[field->which]);
> +        if (!*field->title) strcpy(field->title, typos[field->which]);
>          dlist_add_nomalloc((void *)&TT.fields, (void *)field);

I think you might want to hold off on updating ps; right now, it's
the "current cleanup project", which means that it's likely to break at
random, repeatedly.
If you do update before that finishes, check that it works.

Thanks,
Isaac Dunham

 1429408094.0


More information about the Toybox mailing list