From ae7eae3e334bc155bcace666502578dea50663af Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Sat, 17 Nov 2012 15:31:12 +0800 Subject: [PATCH] Do not forget closing /dev/tty after opening it. --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index dfc4e346b..c67d2a380 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;