From 9765374882bc40bb532fe7d0ef70cb46fa4fcf3e Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 10 Jan 2008 19:21:03 +0000 Subject: backport getkey race fixes from RHEL 5 (#313611, ) --- rc.d/rc.sysinit | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rc.d') diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 0e60ff63..8da2aedf 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -959,15 +959,24 @@ dmesg -s 131072 > /var/log/dmesg # create the crash indicator flag to warn on crashes, offer fsck with timeout touch /.autofsck &> /dev/null -kill -TERM `/sbin/pidof getkey` >/dev/null 2>&1 +if [ "$PROMPT" != no ]; then + while :; do + pid=$(/sbin/pidof getkey) + [ -n "$pid" -o -e /var/run/getkey_done ] && break + usleep 100000 + done + [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1 +fi } & if strstr "$cmdline" confirm ; then touch /var/run/confirm fi if [ "$PROMPT" != "no" ]; then /sbin/getkey i && touch /var/run/confirm + touch /var/run/getkey_done fi wait +[ "$PROMPT" != no ] && rm -f /var/run/getkey_done if [ -x /sbin/redhat-support-check -a -f /var/lib/supportinfo ]; then /sbin/redhat-support-check || { -- cgit