vdev_id: Add error message when $CONFIG is missing

It was observed that vdev_id exists silently when
the $CONFIG file is missing.

This patch adds error message in case vdev_id is
called without default $CONFIG or '-c'. This makes
end user observe the exit message more easily.

Before Patch:
~~~~~~~~~~~~~
$ ./cmd/vdev_id/vdev_id
$

After Patch:
~~~~~~~~~~~~
$ ./cmd/vdev_id/vdev_id
Error: Config file "/etc/zfs/vdev_id.conf" not found
$

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Closes #11498
This commit is contained in:
Arshad Hussain 2021-01-24 05:22:29 +05:30 committed by GitHub
parent 4a90d4d6fc
commit e2870fb24a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -545,6 +545,7 @@ while getopts 'c:d:eg:mp:h' OPTION; do
done
if [ ! -r $CONFIG ] ; then
echo "Error: Config file \"$CONFIG\" not found"
exit 0
fi