]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/strutils: improve strtoul_or_err() for negative numbers
authorKarel Zak <kzak@redhat.com>
Tue, 19 Apr 2022 09:38:57 +0000 (11:38 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Apr 2022 09:38:57 +0000 (11:38 +0200)
commit3b888573661d43ea069e98a083bd10e33a2ece69
tree6b3072d315ed186dc79686c3e0ad499bca02a3f5
parentd7c11b93397c2cff8d0b986110c1fd2ca533ad92
lib/strutils: improve strtoul_or_err() for negative numbers

Let's use the same code for strtoul_or_err() and strtol_or_err() as we
already use for strtoxXX_or_err() functions. It resolves issue with
negative numbers.

This problem has been discovered by "./eject -x -1 -v" where -x is
based on strtoul_or_err(), but accepts negative number (-1).

Reported-by: Enze Li <lienze@kylinos.cn>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/strutils.h
lib/strutils.c