]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/limits.c: Fix wrong error check
authorAlejandro Colomar <alx@kernel.org>
Sat, 2 Sep 2023 13:24:06 +0000 (15:24 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 4 Dec 2023 10:45:09 +0000 (11:45 +0100)
strtol(3) doesn't specify a return value if (value == endptr).
It is always an error, if (value==endptr).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/limits.c

index efb24a546353e7ebdd390cb55a783cbfb0e7162b..b3ea1784ec7b0602f63a093602c4a986fb4eb038 100644 (file)
@@ -62,7 +62,8 @@ static int setrlimit_value (unsigned int resource,
                 */
                char *endptr;
                long longlimit = strtol (value, &endptr, 10);
-               if ((0 == longlimit) && (value == endptr)) {
+
+               if (value == endptr) {
                        /* No argument at all. No-op.
                         * FIXME: We could instead throw an error, though.
                         */