]> git.ipfire.org Git - thirdparty/util-linux.git/commit
login: never send signals to init
authorSamanta Navarro <ferivoz@riseup.net>
Wed, 11 Jan 2023 11:57:21 +0000 (11:57 +0000)
committerSamanta Navarro <ferivoz@riseup.net>
Wed, 11 Jan 2023 11:57:55 +0000 (11:57 +0000)
commit4bbda92cdd0ceacc982f759d97d35b1617a8beba
tree3a60f7023dfe001ec8dcf096cace5760c61be974
parent3870b182b7b0d98f487e023cd0030c8acd2adc1e
login: never send signals to init

If the signal handler is triggered after a failed fork attempt, then
child_pid will be -1. This in turn leads to a positive test and a
subsequent call of kill(1, signal). If signal was SIGTERM, then there
will be also another kill(1, SIGHUP) call.

Test explicitly for a positive child_pid value to prevent these cases.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
login-utils/login.c