35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
|
From 41560df672d0aeb954874b6d0aa81849ab35ca71 Mon Sep 17 00:00:00 2001
|
||
|
From: Ray Strode <rstrode@redhat.com>
|
||
|
Date: Mon, 10 Jun 2013 10:44:56 -0400
|
||
|
Subject: [PATCH] terminal-session: plug /dev/console fd leak
|
||
|
|
||
|
When we stop redirecting console messages, we temporarly open
|
||
|
/dev/console. We don't ever close it.
|
||
|
|
||
|
This commit fixes that.
|
||
|
---
|
||
|
src/libply/ply-terminal-session.c | 6 +++++-
|
||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c
|
||
|
index 3d43709..e7377e9 100644
|
||
|
--- a/src/libply/ply-terminal-session.c
|
||
|
+++ b/src/libply/ply-terminal-session.c
|
||
|
@@ -213,8 +213,12 @@ ply_terminal_session_unredirect_console (ply_terminal_session_t *session)
|
||
|
assert (session->console_is_redirected);
|
||
|
|
||
|
fd = open ("/dev/console", O_RDWR | O_NOCTTY);
|
||
|
- if (fd >= 0)
|
||
|
+ if (fd >= 0) {
|
||
|
ioctl (fd, TIOCCONS);
|
||
|
+ close (fd);
|
||
|
+ } else {
|
||
|
+ ply_trace ("couldn't open /dev/console to stop redirecting it: %m");
|
||
|
+ }
|
||
|
|
||
|
session->console_is_redirected = false;
|
||
|
}
|
||
|
--
|
||
|
1.8.1.4
|
||
|
|