]> xenbits.xensource.com Git - livepatch-build-tools.git/commitdiff
livepatch-tools: remove usage of error.h
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 6 Apr 2023 11:41:06 +0000 (13:41 +0200)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Fri, 28 Apr 2023 16:00:42 +0000 (17:00 +0100)
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é <roger.pau@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
common.h
create-diff-object.c
lookup.c
prelink.c

index 9a9da791a33fb4f5ab4275bf4b8cea98921a09c0..0d3e5f1dd3b5619cac30d464f9485a9a389c7f54 100644 (file)
--- a/common.h
+++ b/common.h
@@ -1,18 +1,21 @@
 #ifndef _COMMON_H_
 #define _COMMON_H_
 
-#include <error.h>
+#include <err.h>
 
 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__)
index 90370b548fc87be2bb83a78b269c794430379669..67784642bcd71915220bc30de17fb98276088d6a 100644 (file)
@@ -45,7 +45,6 @@
 #include <string.h>
 #include <libgen.h>
 #include <argp.h>
-#include <error.h>
 #include <unistd.h>
 #include <time.h>
 #include <gelf.h>
index 39125c613c493aca0828bce1475fe2537c0ad17c..9633ea20e01b6b25158921a3790124df6ab4ca03 100644 (file)
--- a/lookup.c
+++ b/lookup.c
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <error.h>
+#include <err.h>
 #include <gelf.h>
 #include <unistd.h>
 
 #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;
index 2039e5bf9ada340a291a01631d27499eeb8c6ae0..18c5159352a9d16984be4e84d87386c88596c944 100644 (file)
--- a/prelink.c
+++ b/prelink.c
@@ -27,7 +27,6 @@
 #include <string.h>
 #include <libgen.h>
 #include <argp.h>
-#include <error.h>
 #include <unistd.h>
 #include <gelf.h>