On 08.10.21 09:51, Michael Adler wrote:
> The previous comparison with LONG_{MIN,MAX} was (almost) always false
> because the variable for the comparison had already been casted from
> long to int.
>
> Signed-off-by: Michael Adler <
michae...@siemens.com>
> ---
> tools/bg_setenv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
> index d26eeed..043c0aa 100644
> --- a/tools/bg_setenv.c
> +++ b/tools/bg_setenv.c
> @@ -221,16 +221,17 @@ static error_t set_uservars(char *arg)
> static int parse_int(char *arg)
> {
> char *tmp;
> - int i;
> + long i;
>
> errno = 0;
> i = strtol(arg, &tmp, 10);
> if ((errno == ERANGE && (i == LONG_MAX || i == LONG_MIN)) ||
> + (i > INT_MAX || i < INT_MIN) ||