]> git.ipfire.org Git - thirdparty/util-linux.git/commit
agetty: fix characters reorder in login prompt
authorKarel Zak <kzak@redhat.com>
Mon, 27 Mar 2017 12:54:39 +0000 (14:54 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 27 Mar 2017 12:54:39 +0000 (14:54 +0200)
commit790119b8850ae13bb4254c5096a54b2aeb355b20
tree27860e60ec38db62619935773437df4dba5037df
parentca5389757ea51b65ed318700482d60b7ddb8ee16
agetty: fix characters reorder in login prompt

The current agetty uses TIOCSTI ioctl to return already read chars
from login name back to the terminal (without read() before
tcsetattr() we will lost data already written by user). The ioctl
based solution is fragile due to race -- we can return chars when
terminal already contains another new chars. The result is reordered
chars in login name.

The solution is to use extra buffer for already read data.

Reported-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
include/c.h
lib/idcache.c
term-utils/agetty.c