From f6897255a2f326077c6630ddac9e5f6038c245ad Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Wed, 23 Feb 2022 11:53:56 -0300 Subject: [PATCH] kdump-steamos: Strengthen /etc/default/kdump checks Instead of just checking the file existence, check if it's not zero-sized. Signed-off-by: Guilherme G. Piccoli --- kdump-load.sh | 2 +- module-setup.sh | 2 +- submit-report.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kdump-load.sh b/kdump-load.sh index 5cc85f9..a5e9d44 100644 --- a/kdump-load.sh +++ b/kdump-load.sh @@ -46,7 +46,7 @@ grub_update() { fi } -if [ ! -f "/etc/default/kdump" ]; then +if [ ! -s "/etc/default/kdump" ]; then logger "kdump-steamos: /etc/default/kdump not present - aborting..." exit 0 fi diff --git a/module-setup.sh b/module-setup.sh index d7b714c..f3f0992 100644 --- a/module-setup.sh +++ b/module-setup.sh @@ -19,7 +19,7 @@ installkernel() { install() { # Having a valid /etc/default/kdump is essential for kdump. - if [ ! -f "/etc/default/kdump" ]; then + if [ ! -s "/etc/default/kdump" ]; then return 1 fi diff --git a/submit-report.sh b/submit-report.sh index 3f92a43..e0f9ca1 100644 --- a/submit-report.sh +++ b/submit-report.sh @@ -24,7 +24,7 @@ save_locally_and_bail() { # We do some validation to be sure KDUMP_MNT pointed path is valid... # That and having a valid /etc/default/kdump are essential conditions. -if [ ! -f "/etc/default/kdump" ]; then +if [ ! -s "/etc/default/kdump" ]; then logger "kdump-steamos: /etc/default/kdump not present - aborting..." exit 0 fi