diff --git a/target/early/initramfs/sbin_getsh.sh b/target/early/initramfs/sbin_getsh.sh index 666dce0..bc67a54 100644 --- a/target/early/initramfs/sbin_getsh.sh +++ b/target/early/initramfs/sbin_getsh.sh @@ -13,10 +13,12 @@ # GNU General Public License can be found in the file COPYING. # --- SDE-COPYRIGHT-NOTE-END --- -if [ $# -eq 0 ]; then +vc=${1:-/dev/console}; shift + +if [ ! -c "$vc" ]; then + echo "$vc: Invalid terminal" >&2 echo "Usage: \${0##*/} [ ]" exit 1 else - vc=${1:-console}; shift - exec setsid "${@:-/bin/sh}" < /dev/$vc > /dev/$vc 2> /dev/$vc + exec setsid "${@:-/bin/sh}" < $vc > $vc 2> $vc fi