src/check_subid_range.c: Call str2ul() instead of strtoul_noneg()

It is a simpler call, with more type safety.

A consequence of this change is that the program now accepts numbers in
bases 8 and 16.  That's not a problem here, I think.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2024-01-09 14:53:59 +01:00
parent fb49de61b7
commit f3a1e1cf09

View File

@ -13,7 +13,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include "atoi/strtou_noneg.h"
#include "atoi/str2i.h"
#include "defines.h"
#include "prototypes.h"
#include "subordinateio.h"
@ -36,11 +36,9 @@ int main(int argc, char **argv)
owner = argv[1];
check_uids = argv[2][0] == 'u';
errno = 0;
start = strtoul_noneg(argv[3], NULL, 10);
if (errno != 0)
if (str2ul(&start, argv[3]) == -1)
exit(1);
count = strtoul_noneg(argv[4], NULL, 10);
if (errno != 0)
if (str2ul(&count, argv[4]) == -1)
exit(1);
if (check_uids) {
if (have_sub_uids(owner, start, count))