kdumpst-load: Guard initrd creation against failures

Though rare, they might happen and then journal show non-handled
errors - better sanitize a bit the message.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
This commit is contained in:
Guilherme G. Piccoli
2023-12-23 14:56:42 -05:00
parent c81f4e5596
commit b19a940fbd

View File

@ -214,6 +214,12 @@ fi
INITRD_FNAME="${MOUNT_FOLDER}/kdump-initrd-$(uname -r).img"
if [ ! -s "${INITRD_FNAME}" ]; then
create_initrd
# Check if create_initrd() succeeded.
if [ ! -s "${INITRD_FNAME}" ]; then
logger "kdumpst: failure on initrd creation - aborting."
exit 1
fi
fi
if ! kexec -s -p "${VMLINUX}" --initrd "${INITRD_FNAME}" --append="${KDUMP_CMDLINE}"; then