projects/guix·blob python-team · refs

49 lines · 1.2 KiB

1Don't redefine 'closefrom' if available through glibc.
2
3Shamelessly stolen from Gentoo:
4
5 https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-fs/fuse/files/fuse-2.9.9-closefrom-glibc-2-34.patch
6
7diff --git a/configure.ac b/configure.ac
8index 9946a0efa..a2d481aa9 100644
9--- a/configure.ac
10+++ b/configure.ac
11@@ -55,6 +55,7 @@ fi
12
13 AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat])
14 AC_CHECK_FUNCS([posix_fallocate])
15+AC_CHECK_FUNCS([closefrom])
16 AC_CHECK_MEMBERS([struct stat.st_atim])
17 AC_CHECK_MEMBERS([struct stat.st_atimespec])
18
19diff --git a/util/ulockmgr_server.c b/util/ulockmgr_server.c
20index 273c7d923..a04dac5c6 100644
21--- a/util/ulockmgr_server.c
22+++ b/util/ulockmgr_server.c
23@@ -22,6 +22,10 @@
24 #include <sys/socket.h>
25 #include <sys/wait.h>
26
27+#ifdef HAVE_CONFIG_H
28+ #include "config.h"
29+#endif
30+
31 struct message {
32 unsigned intr : 1;
33 unsigned nofd : 1;
34@@ -124,6 +128,7 @@ static int receive_message(int sock, void *buf, size_t buflen, int *fdp,
35 return res;
36 }
37
38+#if !defined(HAVE_CLOSEFROM)
39 static int closefrom(int minfd)
40 {
41 DIR *dir = opendir("/proc/self/fd");
42@@ -141,6 +146,7 @@ static int closefrom(int minfd)
43 }
44 return 0;
45 }
46+#endif
47
48 static void send_reply(int cfd, struct message *msg)
49 {