According to man page, default option can only use reboot, halt, poweroff,
shell and dump_to_rootfs as parameter.
Currently, if configuration kdump.conf is:
------
path /var/crash
core_collector makedumpfile -nosuchfile
default no_such_option
------
kdump service still can be started.
Adding function "check_default_config" to kdumpctl file can solve
this problem.
I have tested this patch in my test machine(Fedora-21).
v1 --> v2
Baoquan He point "check_default_config" function should be call in
"check_config" function.
Wang Li point if kdump.conf donesn't configure the "default" option,
kdump serivce will fail.
Signed-off-by: Qiao Zhao <qzhao(a)redhat.com>
---
kdumpctl | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index ca053a1..eaf7f67 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -259,6 +259,8 @@ check_config()
esac
done < $KDUMP_CONFIG_FILE
+ check_default_config || return 1
+
check_fence_kdump_config || return 1
return 0
@@ -781,6 +783,25 @@ start_dump()
return $?
}
+check_default_config()
+{
+ local default_option
+
+ default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE)
+ if [ -z "$default_option" ]; then
+ return 0
+ else
+ case "$default_option" in
+ reboot|halt|poweroff|shell|dump_to_rootfs)
+ return 0
+ ;;
+ *)
+ echo $"Usage kdump.conf: default
{reboot|halt|poweroff|shell|dump_to_rootfs}"
+ return 1
+ esac
+ fi
+}
+
start()
{
check_config
--
1.9.3