]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: don't reset errno in kmod_file_load_zlib()
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 7 May 2025 13:24:36 +0000 (14:24 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 20 May 2025 02:51:43 +0000 (21:51 -0500)
Currently we reset errno, shortly to be followed by an fcntl() and
gzdopen() calls. Both of those should set errno on failure and preserve
it on success.

Just leave errno as-is, we shouldn't be changing it in this context.

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>
libkmod/libkmod-file-zlib.c

index b26c7d1e6a2ef330a13176b64631c9307e7094a3..d4e0f8c3285bc7c70837682dd8cafaf75594e235 100644 (file)
@@ -60,7 +60,6 @@ int kmod_file_load_zlib(struct kmod_file *file)
                return -EINVAL;
        }
 
-       errno = 0;
        gzfd = fcntl(file->fd, F_DUPFD_CLOEXEC, 3);
        if (gzfd < 0)
                return -errno;