diff --git a/src/main.cpp b/src/main.cpp index dfc4e346..c67d2a38 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -142,8 +142,10 @@ bool shouldUseNewProcess() // Konsole and any debug output or warnings from Konsole are written to // the current terminal bool hasControllingTTY = false; - if (KDE_open("/dev/tty", O_RDONLY) != -1) { + const int fd = KDE_open("/dev/tty", O_RDONLY); + if (fd != -1) { hasControllingTTY = true; + close(fd); } return hasControllingTTY;