lib/limits.c: Fix wrong error check

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>
This commit is contained in:
Alejandro Colomar
2023-09-02 15:24:06 +02:00
committed by Iker Pedrosa
parent 00e4e0c735
commit 9b798b584a
+2 -1
View 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.
*/