From ac867b5609802c48a61de86227d05f654837edf2cd66b7605a2bb1529205855a Mon Sep 17 00:00:00 2001 From: Robert Milasan Date: Thu, 20 Sep 2012 07:10:39 +0000 Subject: [PATCH] Accepting request 135092 from home:jirislaby:branches:Base:System login: close tty before vhangup (bnc#778842) OBS-URL: https://build.opensuse.org/request/show/135092 OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=145 --- login-close-tty-before-vhangup.patch | 39 ++++++++++++++++++++++++++++ util-linux.changes | 5 ++++ util-linux.spec | 3 +++ 3 files changed, 47 insertions(+) create mode 100644 login-close-tty-before-vhangup.patch diff --git a/login-close-tty-before-vhangup.patch b/login-close-tty-before-vhangup.patch new file mode 100644 index 0000000..211e051 --- /dev/null +++ b/login-close-tty-before-vhangup.patch @@ -0,0 +1,39 @@ +From 2e7035646eb85851171cc2e989bfa858a4f00cd4 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 12 Jul 2012 16:33:52 +0200 +Subject: login: close tty before vhangup() +Git-commit: 2e7035646eb85851171cc2e989bfa858a4f00cd4 +Patch-mainline: v2.22-rc1 +References: bnc#778842 + +Let's close all tty file descriptors before vhangup() call. + +References: https://lkml.org/lkml/2012/6/5/145 +Signed-off-by: Karel Zak +Signed-off-by: Jiri Slaby +--- + login-utils/login.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/login-utils/login.c b/login-utils/login.c +index fe13d8d..c0cc00a 100644 +--- a/login-utils/login.c ++++ b/login-utils/login.c +@@ -409,6 +409,14 @@ static void init_tty(struct login_context *cxt) + /* Kill processes left on this tty */ + tcsetattr(0, TCSAFLUSH, &ttt); + ++ /* ++ * Let's close file decriptors before vhangup ++ * https://lkml.org/lkml/2012/6/5/145 ++ */ ++ close(STDIN_FILENO); ++ close(STDOUT_FILENO); ++ close(STDERR_FILENO); ++ + signal(SIGHUP, SIG_IGN); /* so vhangup() wont kill us */ + vhangup(); + signal(SIGHUP, SIG_DFL); +-- +1.7.12 + diff --git a/util-linux.changes b/util-linux.changes index c472788..956f423 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Sep 19 19:41:10 UTC 2012 - jslaby@suse.com + +- login: close tty before vhangup (bnc#778842) + ------------------------------------------------------------------- Fri Jun 22 09:37:20 CEST 2012 - kukuk@suse.de diff --git a/util-linux.spec b/util-linux.spec index 6959f8d..109dcf3 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -102,6 +102,8 @@ Patch10: mount-new-add-loopdev-specific-error-message.patch Patch11: util-linux-2.21.2-noenc.diff Patch12: util-linux-2.21.2-noenc-suse.diff +Patch13: login-close-tty-before-vhangup.patch + # hack for boot.localfs Patch20: util-linux-HACK-boot.localfs.diff ##### @@ -216,6 +218,7 @@ Files to develop applications using the libmount library. %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 # %patch20 -p1