Do not forget closing /dev/tty after opening it.

This commit is contained in:
Jekyll Wu
2012-11-17 15:31:12 +08:00
parent 6bf21efc99
commit ae7eae3e33

View File

@@ -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;