add missing patch
This commit is contained in:
parent
85ffd93331
commit
e1b05c26c4
70
util-linux-2.23-login-TCSANOW.patch
Normal file
70
util-linux-2.23-login-TCSANOW.patch
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
From c5bb244ea3f9fe8d4dbe07080ec811e232629ff8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@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@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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user