From d92b9364ae28e861e25424a1fe58c5092fa97b21 Mon Sep 17 00:00:00 2001 From: Kenneth Dsouza Date: Fri, 10 Aug 2018 06:05:54 +0530 Subject: [PATCH] kdumpctl: Error out if path is set more than once. Currently the kdumpctl script doesn't check if the path option is set more than once due to which a vmcore is not captured. This patch addresses this issue by ensuring that only one path is specified in /etc/kdump.conf file. Signed-off-by: Kenneth D'souza Acked-by: Kairui Song --- kdumpctl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kdumpctl b/kdumpctl index 6a01c13..e07ec06 100755 --- a/kdumpctl +++ b/kdumpctl @@ -204,6 +204,13 @@ check_config() return 1 } + # Check if path option is set more than once. + nr=$(awk 'BEGIN{cnt=0} /^path /{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE) + [ $nr -gt 1 ] && { + echo "Mutiple paths specifed in $KDUMP_CONFIG_FILE" + return 1 + } + nr=$(grep "^dracut_args .*\-\-mount" $KDUMP_CONFIG_FILE | grep -o "\-\-mount" | wc -l) [ $nr -gt 1 ] && { echo "Multiple mount targets specified in one \"dracut_args\"."