From: Tobias Stoeckmann Date: Tue, 10 Sep 2024 16:11:41 +0000 (+0200) Subject: shared: Remove fatal macro X-Git-Tag: v34~332 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3cc6e5998a9fbcfdf24a26e8a44ed44ea1bddaaa;p=thirdparty%2Fkmod.git shared: Remove fatal macro 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 Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/123 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c index f6409868..6f6c2f4e 100644 --- a/libkmod/libkmod-index.c +++ b/libkmod/libkmod-index.c @@ -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); diff --git a/shared/macro.h b/shared/macro.h index e112553d..e4322138 100644 --- a/shared/macro.h +++ b/shared/macro.h @@ -41,7 +41,6 @@ /* Temporaries for importing index handling */ #define NOFAIL(x) (x) -#define fatal(x...) do { } while (0) /* Attributes */