According to man page, default can only use reboot, halt, poweroff, shell and dump_to_rootfs as parameter. Currently, if configuration kdump.conf: ------ path /var/crash core_collector makedumpfile -nosuchfile default no_such_option ------ kdump service still can be start.
Add function "check_default_config" to kdumpctl file can solve this problem.
I have tested this patch in my test machine(Fedora-21).
Signed-off-by: Qiao Zhao qzhao@redhat.com --- kdumpctl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl index ca053a1..9bb8fe3 100755 --- a/kdumpctl +++ b/kdumpctl @@ -781,6 +781,21 @@ start_dump() return $? }
+check_default_config() +{ + local default_option + + default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE) + case "$default_option" in + reboot|halt|poweroff|shell|dump_to_rootfs) + return 0 + ;; + *) + echo $"kdump.conf: default {reboot|halt|poweroff|shell|dump_to_rootfs}" + return 1 + esac +} + start() { check_config @@ -817,6 +832,12 @@ start() fi fi
+ check_default_config + if [ $? -ne 0]; then + echo "Starting kdump: [FAILED]" + return 1 + if + check_rebuild if [ $? != 0 ]; then echo "Starting kdump: [FAILED]"