Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | From 394bf0f1ed07419d40f6024363cc1ffc7ef61bc6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 31 Aug 2017 21:56:25 -0700 |
| 4 | Subject: [PATCH] Replace need for error.h when it does not exist |
| 5 | |
| 6 | helps fixing build on musl |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | brokerUpc.c | 5 ++++- |
| 13 | configure.ac | 2 +- |
| 14 | httpAdapter.c | 4 +++- |
| 15 | support.c | 14 +++++++++++++- |
| 16 | trace.c | 4 +++- |
| 17 | 5 files changed, 24 insertions(+), 5 deletions(-) |
| 18 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 19 | --- a/brokerUpc.c |
| 20 | +++ b/brokerUpc.c |
| 21 | @@ -20,8 +20,11 @@ |
| 22 | |
| 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> |
| 25 | +#ifdef HAVE_ERROR_H |
| 26 | #include <error.h> |
| 27 | - |
| 28 | +#else |
| 29 | +#include <err.h> |
| 30 | +#endif |
| 31 | #include "support.h" |
| 32 | #include "native.h" |
| 33 | #include <sfcCommon/utilft.h> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 34 | --- a/configure.ac |
| 35 | +++ b/configure.ac |
| 36 | @@ -517,7 +517,7 @@ fi |
| 37 | # Checks for header files. |
| 38 | AC_HEADER_STDC |
| 39 | AC_HEADER_SYS_WAIT |
| 40 | -AC_CHECK_HEADERS([fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h zlib.h]) |
| 41 | +AC_CHECK_HEADERS([error.h fcntl.h limits.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h zlib.h]) |
| 42 | AC_CHECK_HEADERS([cmpi/cmpimacs.h cmpi/cmpift.h cmpi/cmpidt.h],[],[AC_MSG_ERROR([Could not find required CPMI header.])]) |
| 43 | |
| 44 | # Checks for typedefs, structures, and compiler characteristics. |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 45 | --- a/httpAdapter.c |
| 46 | +++ b/httpAdapter.c |
| 47 | @@ -71,7 +71,9 @@ |
| 48 | #ifdef HAVE_UDS |
| 49 | #include <grp.h> |
| 50 | #endif |
| 51 | - |
| 52 | +#ifndef __SOCKADDR_ARG |
| 53 | +# define __SOCKADDR_ARG struct sockaddr *__restrict |
| 54 | +#endif |
| 55 | /* should probably go into cimRequest.h */ |
| 56 | #define CIM_PROTOCOL_ANY 0 |
| 57 | #define CIM_PROTOCOL_CIM_XML 1 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 58 | --- a/support.c |
| 59 | +++ b/support.c |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 60 | @@ -27,16 +27,20 @@ |
| 61 | * @sa native.h |
| 62 | */ |
| 63 | |
| 64 | +#include "config.h" |
| 65 | #include <stdio.h> |
| 66 | #include <dlfcn.h> |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 67 | #include "support.h" |
| 68 | #include <stdio.h> |
| 69 | #include <stdlib.h> |
| 70 | +#ifdef HAVE_ERROR_H |
| 71 | #include <error.h> |
| 72 | +#else |
| 73 | +#include <err.h> |
| 74 | +#endif |
| 75 | #include <errno.h> |
| 76 | #include "native.h" |
| 77 | #include "trace.h" |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame^] | 78 | -#include "config.h" |
| 79 | #include "control.h" |
| 80 | #include <pthread.h> |
| 81 | |
| 82 | @@ -331,17 +335,25 @@ loadQualifierDeclMI(const char *provider |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 83 | _SFCB_RETURN(NULL); |
| 84 | }; |
| 85 | |
| 86 | + |
| 87 | /****************************************************************************/ |
| 88 | |
| 89 | /** Exits the program with a memory allocation error message in case the given |
| 90 | * condition holds. |
| 91 | */ |
| 92 | +#if HAVE_ERROR_H |
| 93 | #define __ALLOC_ERROR(cond) \ |
| 94 | if ( cond ) { \ |
| 95 | error_at_line ( -1, errno, __FILE__, __LINE__, \ |
| 96 | "unable to allocate requested memory." ); \ |
| 97 | } |
| 98 | - |
| 99 | +#else |
| 100 | +#define __ALLOC_ERROR(cond) \ |
| 101 | + if ( cond ) { \ |
| 102 | + err(1, "%s:%d: %s", __FILE__, __LINE__, \ |
| 103 | + "unable to allocate requested memory." ); \ |
| 104 | + } |
| 105 | +#endif |
| 106 | /** |
| 107 | * flag to ensure MM is initialized only once |
| 108 | */ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 109 | --- a/trace.c |
| 110 | +++ b/trace.c |
| 111 | @@ -279,7 +279,9 @@ _sfcb_trap(int tn) |
| 112 | } |
| 113 | #endif |
| 114 | } |
| 115 | - |
| 116 | +#ifndef SA_INTERRUPT |
| 117 | +# define SA_INTERRUPT 0x20000000 /* from GLIBC's <bits/sigaction.h> */ |
| 118 | +#endif |
| 119 | sigHandler * |
| 120 | setSignal(int sn, sigHandler * sh, int flags) |
| 121 | { |