[Toybox] [PATCH] Fix ps.c build.
enh
enh at google.com
Sat Jul 18 14:09:43 PDT 2015
ping.
On Fri, May 15, 2015 at 4:38 PM, enh <enh at google.com> wrote:
> Fix ps.c build.
>
> Found by clang...
>
> 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);
> }
> }
>
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
More information about the Toybox
mailing list