From 7573ac58f2febadae9cd03b1043d52265d2523e9 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Mon, 16 May 2011 19:17:57 -0400 Subject: [PATCH] Fix "can't shift that many" crash with empty /proc/cmdline If /proc/cmdline is empty (like if root=... is set in /etc/cmdline), modules.d/99base/init will crash with a message saying "can't shift that many" right before switch_root. The problem is in the block of code that tries to look for init args. It does something like: read CMDLINE : corrected commit message] [Harald Hoyer : fixed indention] Signed-off-by: Will Woods --- modules.d/99base/init | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/modules.d/99base/init b/modules.d/99base/init index e2c34c725..83085028c 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -361,19 +361,18 @@ if getarg init= >/dev/null ; then ignoreargs="console BOOT_IMAGE" # only pass arguments after init= to the init CLINE=${CLINE#*init=} - set $CLINE - shift - for x in "$@"; do - for s in $ignoreargs; do - [ "${x%%=*}" = $s ] && continue 2 - done - initargs="$initargs $x" + set -- $CLINE + shift # clear out the rest of the "init=" arg + for x in "$@"; do + for s in $ignoreargs; do + [ "${x%%=*}" = $s ] && continue 2 done - unset CLINE + initargs="$initargs $x" + done + unset CLINE else set +x # Turn off debugging for this section - set $CLINE - shift + set -- $CLINE for x in "$@"; do case "$x" in [0-9]|s|S|single|emergency|auto ) \ -- 2.47.3