llvm-toolchain/debian/patches/kfreebsd-build-fix.patch
Gianfranco Costamagna 4a695d221a Simplify patch
2015-08-28 07:13:23 +00:00

39 lines
1.5 KiB
Diff

Description: Avoid usage of F_DUPFD_CLOEXEC where not available (e.g. kfreebsd*)
The patch is mostly taken from 10_kfreebsd-f_dupfd_cloexec.patch (gnome-terminal)
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
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Author: Petr Salinger <Petr.Salinger@seznam.cz>
Author: Gianfranco Costamagna <locutusofborg@debian.org>
--- llvm-toolchain-3.7-3.7~+rc3.orig/lldb/source/Plugins/Process/FreeBSD/ProcessPOSIX.cpp
+++ llvm-toolchain-3.7-3.7~+rc3/lldb/source/Plugins/Process/FreeBSD/ProcessPOSIX.cpp
@@ -214,11 +214,24 @@ ProcessPOSIX::DoLaunch (Module *module,
int terminal = m_monitor->GetTerminalFD();
if (terminal >= 0) {
// The reader thread will close the file descriptor when done, so we pass it a copy.
+#ifdef F_DUPFD_CLOEXEC
int stdio = fcntl(terminal, F_DUPFD_CLOEXEC, 0);
if (stdio == -1) {
error.SetErrorToErrno();
return error;
}
+#else
+ int stdio = fcntl(terminal, F_DUPFD, 0);
+ if (stdio == -1) {
+ error.SetErrorToErrno();
+ return error;
+ }
+ stdio = fcntl(terminal, F_SETFD, FD_CLOEXEC);
+ if (stdio == -1) {
+ error.SetErrorToErrno();
+ return error;
+ }
+#endif
SetSTDIOFileDescriptor(stdio);
}