]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
hide 'setsid --help' output in emergency_shell()
authorWill Woods <wwoods@redhat.com>
Tue, 28 Aug 2012 13:43:52 +0000 (09:43 -0400)
committerHarald Hoyer <harald@redhat.com>
Thu, 6 Sep 2012 10:18:06 +0000 (12:18 +0200)
When emergency_shell() happens, it does 'setsid --help' to figure out if
the setsid binary supports the '-c' flag (to set the controlling tty).

This output shows up in the logs (and on-screen if you're using
rd.debug), which keeps confusing people looking for other problems.

Using "case" instead of "strstr" lets us avoid this.

modules.d/99base/dracut-lib.sh

index 60b4cb17a430a5cf7c0db19bac85ec086a653349..fbe6f914aa09119b7e0b33b3e6c79fec92cca6a4 100755 (executable)
@@ -890,7 +890,7 @@ _emergency_shell()
             _ctty=/dev/$_ctty
         fi
         [ -c "$_ctty" ] || _ctty=/dev/tty1
-        strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c"
+        case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty";; esac
         setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
     fi
 }