[util-linux/f19] add missing patch

kzak kzak at fedoraproject.org
Wed Jun 5 12:55:27 UTC 2013


commit e1b05c26c4a81c1e05b1ec507de108872f79c4d9
Author: Karel Zak <kzak at redhat.com>
Date:   Wed Jun 5 14:55:07 2013 +0200

    add missing patch

 util-linux-2.23-login-TCSANOW.patch |   70 +++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/util-linux-2.23-login-TCSANOW.patch b/util-linux-2.23-login-TCSANOW.patch
new file mode 100644
index 0000000..d3e8021
--- /dev/null
+++ b/util-linux-2.23-login-TCSANOW.patch
@@ -0,0 +1,70 @@
+From c5bb244ea3f9fe8d4dbe07080ec811e232629ff8 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 5 Jun 2013 14:31:00 +0200
+Subject: [PATCH] login: use TCSANOW to remove HUPCL
+
+Fedora 19, kernel 3.9, systemd 204, telnetd with socket activation.
+
+login(1) code:
+
+        ttt.c_cflag &= ~HUPCL;
+        tcsetattr(0, TCSAFLUSH, &ttt);
+
+        close(STDIN_FILENO);
+        close(STDOUT_FILENO);
+        close(STDERR_FILENO);
+
+        signal(SIGHUP, SIG_IGN);        /* so vhangup() wont kill us */
+        vhangup();
+        signal(SIGHUP, SIG_DFL);
+
+strace :
+
+	ioctl(0, SNDCTL_TMR_CONTINUE or SNDRV_TIMER_IOCTL_GPARAMS or TCSETSF, {B9600 opost isig icanon echo ...}) = 0
+	close(0)                                = 0
+	close(1)                                = 0
+	close(2)                                = 0
+	--- SIGHUP {si_signo=SIGHUP, si_code=SI_KERNEL} ---
+	--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} ---
+	+++ killed by SIGTERM +++
+
+It seems we get SIGHUP (and SIGTERM from systemd) before vhangup().
+The problem occur sometimes.
+
+I guess it's because TCSAFLUSH is not applied immediately, so it would
+be probably better to use TCSANOW to make the code more robust.
+
+References: https://bugzilla.redhat.com/show_bug.cgi?id=962145
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ login-utils/login.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/login-utils/login.c b/login-utils/login.c
+index 442ad40..554c46d 100644
+--- a/login-utils/login.c
++++ b/login-utils/login.c
+@@ -395,7 +395,7 @@ static void init_tty(struct login_context *cxt)
+ 	}
+ 
+ 	/* Kill processes left on this tty */
+-	tcsetattr(0, TCSAFLUSH, &ttt);
++	tcsetattr(0, TCSANOW, &ttt);
+ 
+ 	/*
+ 	 * Let's close file decriptors before vhangup
+@@ -1312,10 +1312,10 @@ int main(int argc, char **argv)
+ 		close(cnt);
+ 
+ 	setpgrp();	 /* set pgid to pid this means that setsid() will fail */
++	init_tty(&cxt);
+ 
+ 	openlog("login", LOG_ODELAY, LOG_AUTHPRIV);
+ 
+-	init_tty(&cxt);
+ 	init_loginpam(&cxt);
+ 
+ 	/* login -f, then the user has already been authenticated */
+-- 
+1.8.1.4
+


More information about the scm-commits mailing list