From: Emil Velikov Date: Wed, 4 Jun 2025 16:16:25 +0000 (+0100) Subject: libkmod: readback errno before calling kmod_log() X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5670807d2588d1a5fbe4498a3c832ac9c671d8f;p=thirdparty%2Fkmod.git libkmod: readback errno before calling kmod_log() Majority of our code-base reads back errno before calling the kmod_log() to print an error, info or debug message. Correct the last instances for consistency sake. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/368 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index cc11f4d3..cd5cf0eb 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -763,8 +763,8 @@ int index_mm_open(const struct kmod_ctx *ctx, const char *filename, } if ((fd = open(filename, O_RDONLY | O_CLOEXEC)) < 0) { - DBG(ctx, "open(%s, O_RDONLY|O_CLOEXEC): %m\n", filename); err = -errno; + DBG(ctx, "open(%s, O_RDONLY|O_CLOEXEC): %m\n", filename); goto fail_open; } @@ -780,9 +780,9 @@ int index_mm_open(const struct kmod_ctx *ctx, const char *filename, idx->mm = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (idx->mm == MAP_FAILED) { + err = -errno; ERR(ctx, "mmap(NULL, %" PRIu64 ", PROT_READ, MAP_PRIVATE, %d, 0): %m\n", (uint64_t)st.st_size, fd); - err = -errno; goto fail_nommap; }