Maybe strtosize_or_err() is the only function which uses
this errno (wrongly). But it doesnt hurt to maintain rc
as well as errno.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
if (p == str ||
(errno != 0 && (x == UINTMAX_MAX || x == 0))) {
- rc = errno ? -errno : -1;
+ rc = errno ? -errno : -EINVAL;
goto err;
}
if (!p || !*p)
frac = strtoumax(fstr, &p, 0);
if (p == fstr ||
(errno != 0 && (frac == UINTMAX_MAX || frac == 0))) {
- rc = errno ? -errno : -1;
+ rc = errno ? -errno : -EINVAL;
goto err;
}
if (frac && (!p || !*p)) {
done:
*res = x;
err:
+ if (rc < 0)
+ errno = -rc;
return rc;
}