From f3a1e1cf098d0e0a76cc22e50d0c5f37c7190265 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 9 Jan 2024 14:53:59 +0100 Subject: [PATCH] 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 Signed-off-by: Alejandro Colomar --- src/check_subid_range.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/check_subid_range.c b/src/check_subid_range.c index 5dc0bd7d..68266f55 100644 --- a/src/check_subid_range.c +++ b/src/check_subid_range.c @@ -13,7 +13,7 @@ #include #include -#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))