From fb38db29e167dacc51892f718453159fcfa4062f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 4 Apr 2017 13:08:11 +0200 Subject: Consider ENXIO (No such device or address) reason to check isatty() Aligns with EPERM (Operation not permitted) and ENOENT (No such file or directory), and is what errno is set to on macOS when opening the /dev/tty device when running inside e.g. Xcode, where isatty() will return true. Change-Id: I09b88eaa3ff611d95ab37f0ff4df9aaaca52747d Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 6573e0a53e..e525869733 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -197,7 +197,7 @@ static bool willLogToConsole() # elif defined(Q_OS_UNIX) // if /dev/tty exists, we can only open it if we have a controlling TTY int devtty = qt_safe_open("/dev/tty", O_RDONLY); - if (devtty == -1 && (errno == ENOENT || errno == EPERM)) { + if (devtty == -1 && (errno == ENOENT || errno == EPERM || errno == ENXIO)) { // no /dev/tty, fall back to isatty on stderr return isatty(STDERR_FILENO); } else if (devtty != -1) { -- cgit v1.2.3