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

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


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Thu, 6 Apr 2023 11:18:07 +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=nnCA7B702KreQwdKNNPADcBQDwWIhYrArbxnmVXIaVQ=; b=fbeeVzboX55rGvvwI/c99TC0gDegBVWafk/j4PfFdAgQIFl0FcXjcF8ARgxYusCYWB4L667FizjWMc+t0i96UzR7d4uHNJNhvxg1R66pE0waP+MlbuR+3sedBxx/gPuGJP0VjN/MZxaDLScU9cosx+3FoSCuORLP7D4FATZt7ELvJBXwj7r1Aigp5wVjvkddoZ4u7GmrgdYwX3/aGyM/OSfnsqFG6Ow8NmtkQTvMxDNSoXIqt7x82zvnM7SJawvrZK/a9CHPQ4ZXRBauiDrcP/fu9MOg+GWsBIzjQwt+4ltWsdCtTbxZewogiwwjU4tLmhTyr9cpc2ojXc0cws9hNg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C8xNq3oRb7VmN0cOOS3xR+/cJyW6MpesmT4uBtWuSj4MWt6qAdmGPYVKqabs3Cv3uWojdV5QJzwvcZUKwIeXitKV+8xnmN8cZ+FAh4gBFYMfIXfKLF+U8mA4C3diyS/nl7HkOLh9BqDSvPuLDIMBsBWlBir18GTKAu5gzbsJ9E4K/gdItVVRdvpTpMuMfcqzs1bFGJbt/WgjcY1RY9gWyZKyviMMaHZ8z/p/EH8pCAPEwBBi3RYYT0z3s1tMdB+EI4dXJawHUsZ6J1obXw29meFddreNTD3ugZ/ZKuDE74SEgkeqKtSe88yPdjZqsWFL/iO1/5MAqmMWwN5s6n8z6w==
  • 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 09:18:41 +0000
  • Ironport-data: A9a23:PCW4NaJoK4wjPGyxFE+Rz5QlxSXFcZb7ZxGr2PjKsXjdYENShWdRn WVLWjiGOvbYYzOnf9t3aN6/9h8Cvp/UmNQ2SQZlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPTwP9TlK6q4mhA4gRgPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c5TK2dB8 uM9BQk2TQCSnfq58p6DR+pV05FLwMnDZOvzu1lG5BSBV7MMZ8mGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dupTSOpOBy+OGF3N79YNuFSN8Thk+Fj mnH4374ElcRM9n3JT+tqyrw27GSzHyhMG4UPK+i7+9AkACx+kMWJRMLUX2rp8mZ2lHrDrqzL GRRoELCt5Ma5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWbkAHSThbYdBgq84yRhQtz FaCm96vDjtq2IB5UlqY/7aQ6Dm0YC4cKDdYYTdeFVdYpd7+vIs0kxTDCM55F7K4hcH0Hje2x C2WqC85hPMYistjO7iHwG0rSgmE/vDhJjPZLC2ONo55xmuVvLKYWrE=
  • Ironport-hdrordr: A9a23:6QOZb6NUjsdiqsBcTuOjsMiBIKoaSvp037BL7TEVdfUxSKb0qy nAppgmPHPP5wr5IUtQ/uxoW5PwI080l6QU3WB5B97LYOCBggWVxepZnOjfKlPbehEWwdQtsZ uII5IUNDQpNykBsS8h2njBLz/8+qjgzEl1v5ak856yd3AWV0kOhz0JczqmLg==
  • 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 open code an equivalent replacement for the usage
of 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>
---
 common.h             | 10 ++++++----
 create-diff-object.c |  1 -
 lookup.c             |  7 +++++--
 prelink.c            |  1 -
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/common.h b/common.h
index 9a9da79..ec2ea33 100644
--- a/common.h
+++ b/common.h
@@ -1,18 +1,20 @@
 #ifndef _COMMON_H_
 #define _COMMON_H_
 
-#include <error.h>
-
 extern char *childobj;
 
 #define ERROR(format, ...) \
-       error(1, 0, "ERROR: %s: %s: %d: " format, childobj, __FUNCTION__, 
__LINE__, ##__VA_ARGS__)
+({ \
+       fflush(stdout); \
+       fprintf(stderr, "ERROR: %s: %s: %d: " format "\n", childobj, 
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
+       exit(1); \
+})
 
 #define DIFF_FATAL(format, ...) \
 ({ \
        fflush(stdout); \
        fprintf(stderr, "ERROR: %s: " format "\n", childobj, ##__VA_ARGS__); \
-       error(2, 0, "unreconcilable difference"); \
+       exit(2); \
 })
 
 #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..b440102 100644
--- a/lookup.c
+++ b/lookup.c
@@ -28,14 +28,17 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <error.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); \
+       fprintf(stderr, "%s: %d: " format, __FUNCTION__, __LINE__, 
##__VA_ARGS__); \
+       exit(1); \
+})
 
 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®.