aboutsummaryrefslogtreecommitdiffstats
path: root/testing/bwrap-oci/musl.patch
blob: 7b95dc78b241149a1acbaeb51a307134d8a623d6 (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
diff --git a/bwrap-oci.c b/bwrap-oci.c
index a37fea1..1686b0d 100644
--- a/bwrap-oci.c
+++ b/bwrap-oci.c
@@ -19,7 +19,9 @@
 #include <config.h>
 #include <unistd.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#endif
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
diff --git a/configure.ac b/configure.ac
index db26633..9b37286 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,10 +18,32 @@ PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0])
 PKG_CHECK_MODULES(GIO_UNIX, [gio-unix-2.0])
 AC_CHECK_LIB(seccomp, seccomp_rule_add)
 
+AC_CHECK_HEADERS([error.h])
+
 AC_PATH_PROG(BWRAP, [bwrap])
 AC_DEFINE_UNQUOTED([BWRAP], ["$BWRAP"], [Path to bwrap])
 
 AC_CONFIG_FILES([
 Makefile
 ])
+
+AH_BOTTOM([
+#ifndef HAVE_ERROR_H
+#ifndef _ERROR_LOCAL
+#define _ERROR_LOCAL 1
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static void error(int status, int errnum, const char *msg, ...) {
+	if (errnum)
+		fprintf(stderr, ": %s\n", strerror(errnum));
+	else
+		fputc('\n', stderr);
+	if (status)
+		exit(status);
+}
+#endif
+#endif
+])
 AC_OUTPUT
diff --git a/kill.c b/kill.c
index c180098..03527ce 100644
--- a/kill.c
+++ b/kill.c
@@ -19,7 +19,9 @@
 #include <config.h>
 #include "util.h"
 #include "kill.h"
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#endif
 #include <stdlib.h>
 #include <errno.h>
 
diff --git a/list.c b/list.c
index f0260ec..6b216a1 100644
--- a/list.c
+++ b/list.c
@@ -19,7 +19,9 @@
 #include <config.h>
 #include <unistd.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#endif
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
diff --git a/run.c b/run.c
index 1407299..d81bb51 100644
--- a/run.c
+++ b/run.c
@@ -19,7 +19,9 @@
 #include <config.h>
 #include <unistd.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#endif
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
diff --git a/util.c b/util.c
index 8f3a1d4..b56d5ec 100644
--- a/util.c
+++ b/util.c
@@ -20,7 +20,9 @@
 #include "util.h"
 #include <unistd.h>
 #include <stdlib.h>
+#ifdef HAVE_ERROR_H
 #include <error.h>
+#endif
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
@@ -359,7 +361,7 @@ get_bundle_path (const char *rootfs)
 {
   gchar *ret;
   cleanup_free gchar *tmp = g_strdup (rootfs);
-  ret = canonicalize_file_name(dirname (tmp));
+  ret = realpath(dirname (tmp), NULL);
   return ret;
 }