Currently the sed call will read in the whole cmdline if BOOT_IMAGE=
parameter doesn't exist. Later code will use a fallback list to
detect valid path so this error is harmless yet, but still fix it to
save a detection iteration.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdump-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index e18c473..f39f141 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -682,7 +682,7 @@ prepare_kdump_bootinfo()
boot_imglist="$KDUMP_IMG-$KDUMP_KERNELVER$KDUMP_IMG_EXT
$machine_id/$KDUMP_KERNELVER/$KDUMP_IMG"
# Use BOOT_IMAGE as reference if possible, strip the GRUB root device prefix in
(hd0,gpt1) format
- local boot_img="$(cat /proc/cmdline | sed "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\)
.*/\2/")"
+ local boot_img="$(sed -n "s/^BOOT_IMAGE=\((\S*)\)\?\(\S*\) .*/\2/p"
/proc/cmdline)"
if [ -n "$boot_img" ]; then
boot_imglist="$boot_img $boot_imglist"
fi
--
2.26.2
Show replies by thread