diff options
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r-- | src/corelib/global/qlogging.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 6602d53b08..0861763492 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -61,7 +61,10 @@ #include <qt_windows.h> #endif #if QT_CONFIG(slog2) -#include <slog2.h> +#include <sys/slog2.h> +#endif +#if QT_HAS_INCLUDE(<paths.h>) +#include <paths.h> #endif #ifdef Q_OS_ANDROID @@ -215,8 +218,11 @@ static bool willLogToConsole() # ifdef Q_OS_WIN return GetConsoleWindow(); # elif defined(Q_OS_UNIX) +# ifndef _PATH_TTY +# define _PATH_TTY "/dev/tty" +# endif // if /dev/tty exists, we can only open it if we have a controlling TTY - int devtty = qt_safe_open("/dev/tty", O_RDONLY); + int devtty = qt_safe_open(_PATH_TTY, O_RDONLY); if (devtty == -1 && (errno == ENOENT || errno == EPERM || errno == ENXIO)) { // no /dev/tty, fall back to isatty on stderr return isatty(STDERR_FILENO); |