aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/sblim-sfcb/sblim-sfcb/0001-Replace-need-for-error.h-when-it-does-not-exist.patch
blob: 9bb9f443442b72875553a32e5ea1fd285110270a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
From 394bf0f1ed07419d40f6024363cc1ffc7ef61bc6 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Aug 2017 21:56:25 -0700
Subject: [PATCH] Replace need for error.h when it does not exist

helps fixing build on musl

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 brokerUpc.c   |  5 ++++-
 configure.ac  |  2 +-
 httpAdapter.c |  4 +++-
 support.c     | 14 +++++++++++++-
 trace.c       |  4 +++-
 5 files changed, 24 insertions(+), 5 deletions(-)

--- a/brokerUpc.c
+++ b/brokerUpc.c
@@ -20,8 +20,11 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
-
+#else
+#include <err.h>
+#endif
 #include "support.h"
 #include "native.h"
 #include <sfcCommon/utilft.h>
--- a/configure.ac
+++ b/configure.ac
@@ -517,7 +517,7 @@ fi
 # Checks for header files.
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT
-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])
+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])
 AC_CHECK_HEADERS([cmpi/cmpimacs.h cmpi/cmpift.h cmpi/cmpidt.h],[],[AC_MSG_ERROR([Could not find required CPMI header.])])
 
 # Checks for typedefs, structures, and compiler characteristics.
--- a/httpAdapter.c
+++ b/httpAdapter.c
@@ -71,7 +71,9 @@
 #ifdef HAVE_UDS
 #include <grp.h>
 #endif
-
+#ifndef __SOCKADDR_ARG
+# define __SOCKADDR_ARG         struct sockaddr *__restrict
+#endif
 /* should probably go into cimRequest.h */
 #define CIM_PROTOCOL_ANY     0
 #define CIM_PROTOCOL_CIM_XML 1
--- a/support.c
+++ b/support.c
@@ -27,16 +27,20 @@
  *  @sa native.h
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <dlfcn.h>
 #include "support.h"
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#else
+#include <err.h>
+#endif
 #include <errno.h>
 #include "native.h"
 #include "trace.h"
-#include "config.h"
 #include "control.h"
 #include <pthread.h>
 
@@ -331,17 +335,25 @@ loadQualifierDeclMI(const char *provider
   _SFCB_RETURN(NULL);
 };
 
+
 /****************************************************************************/
 
 /** Exits the program with a memory allocation error message in case the given 
  *  condition holds.
  */
+#if HAVE_ERROR_H
 #define __ALLOC_ERROR(cond) \
   if ( cond ) { \
     error_at_line ( -1, errno, __FILE__, __LINE__, \
 		    "unable to allocate requested memory." ); \
   }
-
+#else
+#define __ALLOC_ERROR(cond) \
+  if ( cond ) { \
+    err(1, "%s:%d: %s", __FILE__, __LINE__, \
+		    "unable to allocate requested memory." ); \
+  }
+#endif
 /**
  * flag to ensure MM is initialized only once
  */
--- a/trace.c
+++ b/trace.c
@@ -279,7 +279,9 @@ _sfcb_trap(int tn)
   }
 #endif
 }
-
+#ifndef SA_INTERRUPT
+# define SA_INTERRUPT 0x20000000 /* from GLIBC's <bits/sigaction.h> */
+#endif
 sigHandler     *
 setSignal(int sn, sigHandler * sh, int flags)
 {