Make sure that errors never end up with errno being 0. These code paths
negate the errno value to get a negative value to propagate the fact
that an error occurred. -0 would be 0 again so errors are not detected.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/83
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
size_t linesz, len;
off_t offset;
- if (iter->pos == iter->size)
- return false;
+ if (iter->pos == iter->size) {
+ sv_errno = EINVAL;
+ goto fail;
+ }
line = NULL;
dot = strchr(line, '.');
if (!dot) {
- sv_errno = errno;
+ sv_errno = EINVAL;
ERR(iter->ctx, "kmod_builtin_iter_get_modname: unexpected string without modname prefix\n");
goto fail;
}