kdump-lib-initramfs: harden is_mounted

If the device/mountpoint for findmnt is omitted findmnt will list all
mounted filesystems. In that case it will always return "true". So
explicitly check if an argument was passed to prevent false-positives.

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Philipp Rudo 2023-04-03 16:54:57 +02:00 committed by Coiby Xu
parent 12d9eff9dc
commit ca306cd403
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ kdump_get_conf_val()
is_mounted()
{
findmnt -k -n "$1" > /dev/null 2>&1
[ -n "$1" ] && findmnt -k -n "$1" > /dev/null 2>&1
}
# $1: info type