llvm-toolchain/debian/patches/kfreebsd-build-fix.patch
2015-08-28 07:16:02 +00:00

42 lines
1.6 KiB
Diff

## Description: add some description
## Origin/Author: add some origin or author
## Bug: bug URL
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/ProcessFreeBSD.cpp
+++ llvm-toolchain-3.7-3.7~+rc3/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -462,11 +462,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);
}