From 8826c7ff34f57828dc7f2693cb277d56ca7f06f1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 31 May 2020 23:35:34 +0200 Subject: [PATCH] Fix virtual_terminal.cpp build on FreeBSD - need to shuffle some Linux includes behind an ifdef, and some FreeBSD ones as well - FreeBSD has no notion of major device numbers anymore, so the isTty() function can't really tell. Just ignore the check -- I'm assuming the somewhat-standard isatty() doesn't do what is wanted, since otherwise it would be used. --- virtual_terminal.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/virtual_terminal.cpp b/virtual_terminal.cpp index ecdf9d1d10..b73983d13a 100644 --- a/virtual_terminal.cpp +++ b/virtual_terminal.cpp @@ -26,16 +26,21 @@ along with this program. If not, see . #include #include // linux +#ifdef Q_OS_LINUX #include #include #include +#include +#endif +#ifdef Q_OS_FREEBSD +#include +#endif // system #include #include #include #include #include -#include // c++ #include @@ -81,9 +86,14 @@ static bool isTty(int fd) if (fstat(fd, &st) == -1) { return false; } +#ifdef Q_OS_LINUX + // Not a TTY device or weird vt number, skip it if (major(st.st_rdev) != TTY_MAJOR || minor (st.st_rdev) <= 0 || minor(st.st_rdev) >= 64) { return false; } +#endif + // FreeBSD doesn't have a notion of major device number, so nothing + // to check. isatty() might not do the trick. return true; }