Currently we reset errno prior to calling strto{u,}l(). This is not
needed, since a) we don't check errno to see if the function was
successful and b) we explicitly propagate the error code by returning it
directly to the caller.
Reference: https://github.com/kmod-project/kmod/issues/244
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/346
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
err = read_str_safe(fd, buf, sizeof(buf));
if (err < 0)
return err;
- errno = 0;
v = strtol(buf, &end, base);
if (end == buf || !isspace(*end))
return -EINVAL;
err = read_str_safe(fd, buf, sizeof(buf));
if (err < 0)
return err;
- errno = 0;
v = strtoul(buf, &end, base);
if (end == buf || !isspace(*end))
return -EINVAL;