From: Roger Pau Monne Date: Thu, 6 Apr 2023 11:41:06 +0000 (+0200) Subject: livepatch-tools: remove usage of error.h X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=37053cb6fe61f96ac447d3a0d652b627a6dcc352;p=livepatch-build-tools.git livepatch-tools: remove usage of error.h It's a GNU libc specific header which prevents building on musl for example. Instead use errx() in ERROR() and DIFF_FATAL() macros. Signed-off-by: Roger Pau Monné Reviewed-by: Ross Lagerwall Signed-off-by: Ross Lagerwall --- diff --git a/common.h b/common.h index 9a9da79..0d3e5f1 100644 --- a/common.h +++ b/common.h @@ -1,18 +1,21 @@ #ifndef _COMMON_H_ #define _COMMON_H_ -#include +#include extern char *childobj; #define ERROR(format, ...) \ - error(1, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__) +({ \ + fflush(stdout); \ + errx(1, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +}) #define DIFF_FATAL(format, ...) \ ({ \ fflush(stdout); \ fprintf(stderr, "ERROR: %s: " format "\n", childobj, ##__VA_ARGS__); \ - error(2, 0, "unreconcilable difference"); \ + errx(2, "unreconcilable difference"); \ }) #define log_debug(format, ...) log(DEBUG, format, ##__VA_ARGS__) diff --git a/create-diff-object.c b/create-diff-object.c index 90370b5..6778464 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include diff --git a/lookup.c b/lookup.c index 39125c6..9633ea2 100644 --- a/lookup.c +++ b/lookup.c @@ -28,14 +28,17 @@ #include #include #include -#include +#include #include #include #include "lookup.h" #define ERROR(format, ...) \ - error(1, 0, "%s: %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__) +({ \ + fflush(stdout); \ + errx(1, "%s: %d: " format, __FUNCTION__, __LINE__, ##__VA_ARGS__); \ +}) struct symbol { unsigned long value; diff --git a/prelink.c b/prelink.c index 2039e5b..18c5159 100644 --- a/prelink.c +++ b/prelink.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include