Skip to content

Commit

Permalink
vdev_id: Add error message when $CONFIG is missing
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Arshad Hussain <[email protected]>
Closes openzfs#11498
  • Loading branch information
arshad512 authored and jsai20 committed Mar 30, 2021
1 parent e91611e commit 312ca4e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/vdev_id/vdev_id
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 312ca4e

Please sign in to comment.