Package: gnome-terminal / 3.14.1-1

10_kfreebsd-f_dupfd_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
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711529
Description: Fix build on kfreebsd

kfreebsd doesn't have F_DUPFD_CLOEXEC, so use it conditionally.
As mentioned in the bug report, it will have support for it in
jessie, so we can drop it in jessie+1.

--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -184,6 +184,20 @@
 static TerminalURLFlavour *url_regex_flavors;
 static guint n_url_regexes;
 
+#ifdef F_DUPFD_CLOEXEC
+static inline int dup_cloexec(int fd, int hint)
+{
+  return fcntl (fd, F_DUPFD_CLOEXEC, hint);
+}
+#else
+static inline int dup_cloexec(int fd, int hint)
+{
+  if ((fd = fcntl (fd, F_DUPFD, hint)) == -1)
+    return -1;
+  return fcntl (fd, F_SETFD, FD_CLOEXEC);
+}
+#endif
+
 /* See bug #697024 */
 #ifndef __linux__
 
@@ -1192,7 +1206,7 @@
       for (j = 0; j < n_fds; j++) {
         if (fds[j] == target_fd) {
           do {
-            fd = fcntl (fds[j], F_DUPFD_CLOEXEC, 3);
+            fd = dup_cloexec(fds[j], 3);
           } while (fd == -1 && errno == EINTR);
           if (fd == -1)
             _exit (127);