From 00f8bb60d400a1d3ee051b4dd3e1ec8efa5be068 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 23 Jan 2023 21:27:09 -0800 Subject: [PATCH] Properly handle case where showmount command is missing https://github.com/webmin/webmin/issues/1829 --- mount/linux-lib.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mount/linux-lib.pl b/mount/linux-lib.pl index 4e1b3b278..4607ee90f 100755 --- a/mount/linux-lib.pl +++ b/mount/linux-lib.pl @@ -1680,20 +1680,20 @@ if (($_[0] eq "nfs") || ($_[0] eq "nfs4")) { elsif ($?) { &error(&text('linux_elist', $out)); } - } - # Validate directory name for NFSv3 (in v4 '/' exists) - foreach (split(/\n/, $out)) { - if (/^(\/\S+)/) { - $dirlist .= "$1\n"; - push(@dirlist, $1); + # Validate directory name for NFSv3 (in v4 '/' exists) + foreach (split(/\n/, $out)) { + if (/^(\/\S+)/) { + $dirlist .= "$1\n"; + push(@dirlist, $1); + } } - } - if ($_[0] ne "nfs4" && $in{'nfs_dir'} !~ /^\/.*$/ && - &indexof($in{'nfs_dir'}, @dirlist) < 0) { - &error(&text('linux_enfsdir', $in{'nfs_dir'}, - $in{'nfs_host'}, "
$dirlist
")); + if ($_[0] ne "nfs4" && $in{'nfs_dir'} !~ /^\/.*$/ && + &indexof($in{'nfs_dir'}, @dirlist) < 0) { + &error(&text('linux_enfsdir', $in{'nfs_dir'}, + $in{'nfs_host'}, "
$dirlist
")); + } } return "$in{nfs_host}:$in{nfs_dir}";