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

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


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 6 Apr 2023 10:36:37 +0100
  • 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=HUMCD5S95GqMGMWGQq2L1ujqOJ5fEhqwkrZ8ijeAgxo=; b=UViZDI0R8Ha17jHq1c/T1+gXV66iacOq9W8upkgSRJWuEz7SgfZA5UNGZTsVnBbXqIuTMaqJUt6XVyVYm4MzCoqHdp8M+EMLqM/S8eN1ycfF1PIpKslB06nlF9G/Kcnmm+24pvR/EkQjOuP1Q0TEj0joKEFjtB7Dq+1DaxNBsNy5lGlP30CqWP8Pyxfj/fjzxtondXVXlCbd9vyINE4kfu8WdTD3HYlTP9MnL88xJparkkE5bIhJpj3Do761zKw3yvRqpAe2b/vNAMF9qdUgfSzU+GouNqJrAj3LAUHPkTn9Z8JaIlejlqshYp7+7msMABwq6Mdipn5hFTf23KAYtw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RsYT0v2X80oAAjqV4g7zDqizvfABnFPRX73JuHqfW3Ov+3zsqZ/j6kN8XMKzrdHB2pAdyLgxCZj1eXODSPX06csYq6nZfQQQz+z5fjRUUeWe7fum8NRwL6QMLD2HuF49TMLEXUDsSbQy1/phnoCJtFmZgQvgBpb9eyIMY3mu7WJif8OtG9mxfs8qT9APMyRlN/f2sQaw5IIU+pXYl8TDDgKFHOA4XDjZ2e/rpTrvuvdQKsU+Y8yqa/ljD6ge9cMLmwVqEwo3maNO71cNTyx/3bbqRxoLHbt9lJurDfWzUKBd0ucRinVR9bOfBxpM3vQ1y5dP6zdK7wjK6Evd8+PUpA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Delivery-date: Thu, 06 Apr 2023 09:37:13 +0000
  • Ironport-data: A9a23:a3weoao8JLZ+ctnYh8Vq2QtiN7leBmI9ZBIvgKrLsJaIsI4StFCzt garIBmEbvuPMTDyc9wibNmx8U9U6sOGz95nHQQ+rn8zQS4TpJuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpA1c/Ek/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06WNwUmAWP6gR5weCzydNVfrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXABsIYw6voc+u+4yQZe5DgvwHJfbkP7pK7xmMzRmBZRonabbqZvyQoPpnhnI3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3juarbIe9lt+iHK25mm6xo G7c8nu/KRYdLNGFkhKO8262h/+JliT+MG4XPOTgqK803gXOmQT/DjUdflaWqvmoiXWZXoxOB RAs03AWsrIboRnDot7VGkfQTGS/lg4RXZ9cHvM37CmJy7HI+ECJC24cVDlDZdc68sgsSlQC1 ViPhdrlQyNutL69TmiU/bOZ6zi1PEAowXQqYCYFSU4A/IPlqYRq1BbXFI4/Teiyk8H/Hiz2z 3aSti8iir4PjMkNkaKm4VTAhDHqrZ/MJuIo2jjqsquexlsRTOaYi0aAsDA3Md4owF6lc2S8
  • Ironport-hdrordr: A9a23:t723GKplRNVMq88FTAWyg9YaV5rveYIsimQD101hICG9Evb0qy nOpoV/6faQslwssR4b9uxoVJPvfZq+z+8W3WByB9eftWDd0QPFEGgL1+DfKlbbak7DH4BmtJ uJc8JFeafN5VoRt7eG3OFveexQvOVu88qT9JjjJ28Gd3APV0n5hT0JcjpyFCdNNW57LKt8Lr WwzOxdqQGtfHwGB/7LfUXsD4D41rv2fIuNW29+OyIa
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06/04/2023 10:18 am, Roger Pau Monne wrote:
> 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); \
>  })

Looking at the usage, can't we just use err() instead?

Also, I suspect you don't intend to delete the error message in
DIFF_FATAL() ?

~Andrew



 


Rackspace

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