Package: syncevolution / 1.4.99.4-3

0001-Fix-FTBFS-on-kfreebsd-due-to-missing-SOCK_CLOEXEC.patch Patch series | download
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
From 0a4e4b6575bfe10902c8cccd9c849b6168c66aea Mon Sep 17 00:00:00 2001
From: Tino Mettler <tino+debian@tikei.de>
Date: Sun, 26 Oct 2014 12:54:31 +0100
Subject: [PATCH] Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC

Work around missing SOCK_CLOEXEC on kfreebsd by setting FD_CLOEXEC
afterwards.
---
 src/gdbusxx/gdbus-cxx-bridge.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/gdbusxx/gdbus-cxx-bridge.cpp b/src/gdbusxx/gdbus-cxx-bridge.cpp
index 238b52f..4f25957 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.cpp
+++ b/src/gdbusxx/gdbus-cxx-bridge.cpp
@@ -276,6 +276,10 @@ void DBusConnectionPtr::setDisconnect(const Disconnect_t &func)
                              true);
 }
 
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
+
 boost::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const NewConnection_t &newConnection, DBusErrorCXX *)
 {
     // Create two fds connected via a two-way stream. The parent
@@ -286,6 +290,21 @@ boost::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const NewConnection_t &ne
     if (retval) {
         SE_THROW(StringPrintf("socketpair: %s", strerror(errno)));
     }
+
+    if(SOCK_CLOEXEC == 0) {
+	int flags;
+	int i;
+	for(i = 0; i < 2; i++) {
+	    flags = fcntl(fds[i], F_GETFD);
+	    if (flags == -1){
+		SE_THROW(StringPrintf("fcntl: %s", strerror(errno)));
+	    }
+	    flags |= FD_CLOEXEC;
+	    if (fcntl(fds[i], F_SETFD, flags) == -1){
+		SE_THROW(StringPrintf("fcntl: %s", strerror(errno)));
+	    }
+	}
+    }
     GuardFD parentfd(fds[0]);
     GuardFD childfd(fds[1]);
 
-- 
2.1.3