]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/check_subid_range.c: Call str2ul() instead of strtoul_noneg()
authorAlejandro Colomar <alx@kernel.org>
Tue, 9 Jan 2024 13:53:59 +0000 (14:53 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 27 May 2024 14:32:09 +0000 (16:32 +0200)
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>
src/check_subid_range.c

index 5dc0bd7d5ce7109bc9e48229465ba23121e53324..68266f55847d3a0dc53a3bbb2659eed13d1061ba 100644 (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))