summaryrefslogtreecommitdiff
path: root/opt/firejail/musl.patch
blob: 43473ea85962c1941ccaecb58c664f37c4162d15 (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
--- a/src/libtrace/libtrace.c
+++ b/src/libtrace/libtrace.c
@@ -447,7 +447,7 @@
 	return rv;
 }
 
-#ifndef stat64
+#ifdef HAVE_STAT64
 typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *statbuf);
 static orig_stat64_t orig_stat64 = NULL;
 int stat64(const char *pathname, struct stat64 *statbuf) {
@@ -472,7 +472,7 @@
 	return rv;
 }
 
-#ifndef lstat64
+#ifdef HAVE_STAT64
 typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *statbuf);
 static orig_lstat64_t orig_lstat64 = NULL;
 int lstat64(const char *pathname, struct stat64 *statbuf) {
--- a/src/libtracelog/libtracelog.c
+++ b/src/libtracelog/libtracelog.c
@@ -565,7 +565,7 @@
 	return rv;
 }
 
-#ifndef stat64
+#ifdef HAVE_STAT64
 typedef int (*orig_stat64_t)(const char *pathname, struct stat64 *buf);
 static orig_stat64_t orig_stat64 = NULL;
 int stat64(const char *pathname, struct stat64 *buf) {
@@ -601,7 +601,7 @@
 	return rv;
 }
 
-#ifndef lstat64
+#ifdef HAVE_STAT64
 typedef int (*orig_lstat64_t)(const char *pathname, struct stat64 *buf);
 static orig_lstat64_t orig_lstat64 = NULL;
 int lstat64(const char *pathname, struct stat64 *buf) {
--- a/config.mk.in
+++ b/config.mk.in
@@ -22,6 +22,8 @@
 localstatedir=@localstatedir@
 sysconfdir=@sysconfdir@
 
+HAVE_STAT64=@HAVE_STAT64@
+
 # Misc flags
 BUSYBOX_WORKAROUND=@BUSYBOX_WORKAROUND@
 HAVE_CONTRIB_INSTALL=@HAVE_CONTRIB_INSTALL@
@@ -99,7 +101,7 @@
 	-fstack-protector-all \
 	-DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/$(TARNAME)"' \
 	-DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' \
-	-DVARDIR='"$(localstatedir)/lib/$(TARNAME)"'
+	-DVARDIR='"$(localstatedir)/lib/$(TARNAME)"' $(HAVE_STAT64)
 
 PROG_CFLAGS = \
 	$(COMMON_CFLAGS) \
--- a/configure.ac
+++ b/configure.ac
@@ -298,6 +298,10 @@
 AC_CHECK_HEADER([linux/seccomp.h], [],
     [AC_MSG_ERROR([*** SECCOMP support is not installed (/usr/include/linux/seccomp.h missing) ***])])
 
+AC_SUBST([HAVE_STAT64])
+AC_CHECK_FUNC(stat64, [
+	HAVE_STAT64="-DHAVE_STAT64"],)
+
 # set sysconfdir
 if test "$prefix" = /usr; then
 	test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc"
--- a/src/fbwrap/main.c
+++ b/src/fbwrap/main.c
@@ -23,7 +23,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <linux/prctl.h>
 #include <sys/prctl.h>
 #include <signal.h>