]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
shared: Remove fatal macro
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 10 Sep 2024 16:11:41 +0000 (18:11 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 17 Sep 2024 03:22:39 +0000 (22:22 -0500)
The fatal macro was never implemented. Its only user, libkmod-index,
should propagate error condition through errno as good as possible.

Other logging mechanisms are not available without adjusting API
because context is missing.

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/123
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-index.c
shared/macro.h

index f6409868d18e0eb5ee2f5fb279fd4b9bb9e61f37..6f6c2f4e7685e10a4f238b6bd7fd917319bbed9a 100644 (file)
@@ -166,12 +166,6 @@ static int add_value(struct index_value **values,
        return 0;
 }
 
-static void read_error(void)
-{
-       fatal("Module index: unexpected error: %s\n"
-                       "Try re-running depmod\n", errno ? strerror(errno) : "EOF");
-}
-
 static int read_char(FILE *in)
 {
        int ch;
@@ -179,7 +173,7 @@ static int read_char(FILE *in)
        errno = 0;
        ch = getc_unlocked(in);
        if (ch == EOF)
-               read_error();
+               errno = EINVAL;
        return ch;
 }
 
@@ -189,7 +183,7 @@ static int read_long(FILE *in, uint32_t *l)
 
        errno = 0;
        if (fread(&val, sizeof(uint32_t), 1, in) != 1) {
-               read_error();
+               errno = EINVAL;
                return -1;
        }
        *l = ntohl(val);
index e112553db5757a431e8cb445507226c840266328..e432213802c6a9246a171c48c836d7c3835126ab 100644 (file)
@@ -41,7 +41,6 @@
 
 /* Temporaries for importing index handling */
 #define NOFAIL(x) (x)
-#define fatal(x...) do { } while (0)
 
 /* Attributes */