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 | |
| 19 | diff --git a/brokerUpc.c b/brokerUpc.c |
| 20 | index 17cbd9b..fe2b347 100644 |
| 21 | --- a/brokerUpc.c |
| 22 | +++ b/brokerUpc.c |
| 23 | @@ -20,8 +20,11 @@ |
| 24 | |
| 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> |
| 27 | +#ifdef HAVE_ERROR_H |
| 28 | #include <error.h> |
| 29 | - |
| 30 | +#else |
| 31 | +#include <err.h> |
| 32 | +#endif |
| 33 | #include "support.h" |
| 34 | #include "native.h" |
| 35 | #include <sfcCommon/utilft.h> |
| 36 | diff --git a/configure.ac b/configure.ac |
| 37 | index ab2964e..d4915a1 100644 |
| 38 | --- a/configure.ac |
| 39 | +++ b/configure.ac |
| 40 | @@ -517,7 +517,7 @@ fi |
| 41 | # Checks for header files. |
| 42 | AC_HEADER_STDC |
| 43 | AC_HEADER_SYS_WAIT |
| 44 | -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]) |
| 45 | +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]) |
| 46 | AC_CHECK_HEADERS([cmpi/cmpimacs.h cmpi/cmpift.h cmpi/cmpidt.h],[],[AC_MSG_ERROR([Could not find required CPMI header.])]) |
| 47 | |
| 48 | # Checks for typedefs, structures, and compiler characteristics. |
| 49 | diff --git a/httpAdapter.c b/httpAdapter.c |
| 50 | index 2719e6c..e768972 100644 |
| 51 | --- a/httpAdapter.c |
| 52 | +++ b/httpAdapter.c |
| 53 | @@ -71,7 +71,9 @@ |
| 54 | #ifdef HAVE_UDS |
| 55 | #include <grp.h> |
| 56 | #endif |
| 57 | - |
| 58 | +#ifndef __SOCKADDR_ARG |
| 59 | +# define __SOCKADDR_ARG struct sockaddr *__restrict |
| 60 | +#endif |
| 61 | /* should probably go into cimRequest.h */ |
| 62 | #define CIM_PROTOCOL_ANY 0 |
| 63 | #define CIM_PROTOCOL_CIM_XML 1 |
| 64 | diff --git a/support.c b/support.c |
| 65 | index c7bba8b..5b3eef1 100644 |
| 66 | --- a/support.c |
| 67 | +++ b/support.c |
| 68 | @@ -32,7 +32,11 @@ |
| 69 | #include "support.h" |
| 70 | #include <stdio.h> |
| 71 | #include <stdlib.h> |
| 72 | +#ifdef HAVE_ERROR_H |
| 73 | #include <error.h> |
| 74 | +#else |
| 75 | +#include <err.h> |
| 76 | +#endif |
| 77 | #include <errno.h> |
| 78 | #include "native.h" |
| 79 | #include "trace.h" |
| 80 | @@ -331,17 +335,25 @@ loadQualifierDeclMI(const char *provider, |
| 81 | _SFCB_RETURN(NULL); |
| 82 | }; |
| 83 | |
| 84 | + |
| 85 | /****************************************************************************/ |
| 86 | |
| 87 | /** Exits the program with a memory allocation error message in case the given |
| 88 | * condition holds. |
| 89 | */ |
| 90 | +#if HAVE_ERROR_H |
| 91 | #define __ALLOC_ERROR(cond) \ |
| 92 | if ( cond ) { \ |
| 93 | error_at_line ( -1, errno, __FILE__, __LINE__, \ |
| 94 | "unable to allocate requested memory." ); \ |
| 95 | } |
| 96 | - |
| 97 | +#else |
| 98 | +#define __ALLOC_ERROR(cond) \ |
| 99 | + if ( cond ) { \ |
| 100 | + err(1, "%s:%d: %s", __FILE__, __LINE__, \ |
| 101 | + "unable to allocate requested memory." ); \ |
| 102 | + } |
| 103 | +#endif |
| 104 | /** |
| 105 | * flag to ensure MM is initialized only once |
| 106 | */ |
| 107 | diff --git a/trace.c b/trace.c |
| 108 | index d7f30db..438af46 100644 |
| 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 | { |
| 122 | -- |
| 123 | 2.14.1 |
| 124 | |