git: 86f33b5fcf60 - main - elfctl: allow features to be specified by value
Charlie Li
ml+freebsd at vishwin.info
Fri Jan 22 21:21:49 UTC 2021
Ed Maste wrote:
> diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c
> index 20a2c5b95444..f641b63e32bd 100644
> --- a/usr.bin/elfctl/elfctl.c
> +++ b/usr.bin/elfctl/elfctl.c
> @@ -245,9 +247,26 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val)
> }
> }
> if (i == len) {
> - warnx("%s is not a valid feature", feature);
> - if (!iflag)
> - return (false);
> + if (isdigit(feature[0])) {
> + char *eptr;
> + long val;
> +
> + errno = 0;
> + val = strtol(feature, &eptr, 0);
> + if (eptr == feature || *eptr != '\0')
> + errno = EINVAL;
> + else if (val > UINT_MAX)
> + errno = ERANGE;
> + if (errno != 0) {
> + warn("%s invalid", feature);
> + return (false);
> + }
> + input != val;
> + } else {
> + warnx("%s is not a valid feature", feature);
> + if (!iflag)
> + return (false);
> + }
> }
> }
>
Build fails:
--- elfctl.o ---
/usr/src/usr.bin/elfctl/elfctl.c:264:11: error: inequality comparison
result unused [-Werror,-Wunused-comparison]
input != val;
~~~~~~^~~~~~
/usr/src/usr.bin/elfctl/elfctl.c:264:11: note: use '|=' to turn this
inequality comparison into an or-assignment
input != val;
^~
|=
1 error generated.
*** [elfctl.o] Error code 1
make[4]: stopped in /usr/src/usr.bin/elfctl
--
Charlie Li
…nope, still don't have an exit line.
(This email address is for mailing list use; replace local-part with
vishwin for off-list communication if possible)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/dev-commits-src-main/attachments/20210122/4cf4f985/attachment.sig>
More information about the dev-commits-src-main
mailing list