]> git.ipfire.org Git - thirdparty/util-linux.git/commit
login: fix signal race
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 25 Sep 2017 19:54:11 +0000 (21:54 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 26 Sep 2017 10:03:24 +0000 (12:03 +0200)
commitf17bda66bd440fe8375f5fd13e2efa6bd3a0c942
treeeab5e1fef8a164903f27bdcc8025f69d5fea7cbd
parent14b3dd0fc65d519440594852abf7710a2ec71464
login: fix signal race

The functions warnx(3) and gettext(3) are not safe to use within signal
handlers and should be avoided. Preparing the message beforehand and
calling write(2) as well as calling _exit(2) solves the problem.

[kzak@redhat.com: - use program_invocation_short_name rather than argv[0],
                  - use ignore_result() to keep compiler happy]

Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c