[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] livepatch-tools: remove usage of error.h


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 6 Apr 2023 13:41:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=waqCQJYQpwRKwKZIL9b/VKrKkOu4lwBg+iCU1akNzjg=; b=oYzQEFjLYksgKWJd+UorPFNdZg7T0OHHgi5aa3/qeED2A5HPLcVlO5tBDN8gspmWigJ3cm2XwteQgAF0/VwfMrnJ/VQYHO1wi98Q7sUXI81hsB/IGSENv0RioWPCf7wHZUhbCVx9uHR3QBgOP5CdfChsSHqo4T+LgvQz9dBxOCwtu2NEV+/NT5iCS5dWh3AwwChVapk+XLDArRuEk3z1v/f+26g7OZFSxEaplVZLPRfV2iy+/jx0SkzXoqk7NxRkcT+TpvF2I/zgmkkwOL5mxGukTbwZ/tAcikKoqkT4tDntWGRaUs7Dwp+pk/WOY9nwHjpWlpHQjx0eLj4SabaSJQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNotY7T17C5arjjADDIK3ynwFtruXaQ7q4h/OD3p/0r6yDIqG3JJD/g+e1g/KpQYZTMg2Bsybd2W7di75xTIQNd+IW5Plqe7GM2bBD/iXdr48jAKEVKYCXdAl2rOZhqRhYzo29tlvveVmCD6lAKC9nmOoNj0QK66/w661yeFnCFgFUYoD42bYiAjUrNhZYrQPHZieXrcgQV8Aqfe8N0y1q8fgxg7fEd/ncVigSZhu2a5pAiu6TqwPa9cAIJxqGKAfDRdq/UzoSIc52ctdq6jyTpU6FKQageiwCGLCnnnuWd28gzddwXw9852B6p+aELBFhdriuv2ve7eXVzKsXdVDA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Delivery-date: Thu, 06 Apr 2023 11:41:31 +0000
  • Ironport-data: A9a23:IcbTPaKBkrdRN7kPFE+Rz5QlxSXFcZb7ZxGr2PjKsXjdYENS0zQPx msZWWyObKuNYWCnftt1bo7g9UpVup/cnNZqTVNlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPTwP9TlK6q4mhA4gRgPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5eI35D7 aVFEgkcTUGao8Lm+o2pY/dj05FLwMnDZOvzu1lG5BSBV7MKZMuGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dppTSPpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyrw27+Xxn2lMG4UPO2a/MM03wCZ+n0SVyELaUqYjcWlmmfrDrqzL GRRoELCt5Ma5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWbkAHSThbYdBgq84yRhQtz FaCm96vDjtq2IB5UlqY/7aQ6D+3Yi4cKDdYYTdeFVdZpd7+vIs0kxTDCM55F7K4hcH0Hje2x C2WqC85hPMYistjO7iHwG0rSgmE/vDhJjPZLC2ONo55xmuVvLKYWrE=
  • Ironport-hdrordr: A9a23:Wb7A56M3QeUjxcBcTsajsMiBIKoaSvp037BN7TEWdfU1SL3+qy nKpp8mPHDP+VMssR0b6LO90de7Lk80hKQU3WB5B97LMDUO01HYSL2Kg7GSoQEJ00XFmNK0nc 9bGZSXQrXLYGSTba7BgTWFLw==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
Changes since v1:
 - Use errx().
---
 common.h             | 9 ++++++---
 create-diff-object.c | 1 -
 lookup.c             | 7 +++++--
 prelink.c            | 1 -
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/common.h b/common.h
index 9a9da79..bbaa950 100644
--- 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 "\n", 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 780e6c8..d8a0032 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -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>
diff --git a/lookup.c b/lookup.c
index 39125c6..9633ea2 100644
--- a/lookup.c
+++ b/lookup.c
@@ -28,14 +28,17 @@
 #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;
diff --git a/prelink.c b/prelink.c
index 2039e5b..18c5159 100644
--- 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>
 
-- 
2.40.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.