Bug#711529: gnome-terminal: FTBFS on GNU/kFreeBSD

Petr Salinger Petr.Salinger at seznam.cz
Fri Jun 7 14:13:57 UTC 2013


Package: gnome-terminal
Version: 3.8.2-1
Severity: serious
Tags: patch
User: debian-bsd at lists.debian.org
Usertags: kfreebsd


Hi,

the current version fails to build on GNU/kFreeBSD.
The F_DUPFD_CLOEXEC is not widespread fcntl, see also changes between
http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

Please allow also fallback variant.

Petr


--- src/terminal-screen.c
+++ src/terminal-screen.c
@@ -190,8 +190,20 @@
  static TerminalURLFlavour *url_regex_flavors;
  static guint n_url_regexes;

+#ifdef __linux__
+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);
+}
+
  /* See bug #697024 */
-#ifndef __linux__

  #undef dup3
  #define dup3 fake_dup3
@@ -1342,7 +1355,7 @@
        for (j = 0; j < n_fds; j++) {
          if (fds[j] == target_fd) {
            do {
-            fd = fcntl (fds[j], F_DUPFD_CLOEXEC, 10);
+            fd = dup_cloexec(fds[j], 10);
            } while (fd == -1 && errno == EINTR);
            if (fd == -1)
              _exit (127);



More information about the pkg-gnome-maintainers mailing list