diff options
author | Karel Zak | 2013-06-05 14:31:00 +0200 |
---|---|---|
committer | Karel Zak | 2013-06-05 14:43:21 +0200 |
commit | c5bb244ea3f9fe8d4dbe07080ec811e232629ff8 (patch) | |
tree | 35e1a6e6f8db2df37da0154fd6b71b16f1358708 /login-utils/runuser.1 | |
parent | agetty: don't remove ECHOCTL from c_lflag (diff) | |
download | kernel-qcow2-util-linux-c5bb244ea3f9fe8d4dbe07080ec811e232629ff8.tar.gz kernel-qcow2-util-linux-c5bb244ea3f9fe8d4dbe07080ec811e232629ff8.tar.xz kernel-qcow2-util-linux-c5bb244ea3f9fe8d4dbe07080ec811e232629ff8.zip |
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>
Diffstat (limited to 'login-utils/runuser.1')
0 files changed, 0 insertions, 0 deletions