mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 13:47:13 +03:00
libvirt-guests: detect invalid arguments
Reject extra arguments. Return the correct status for unknown arguments, as mandated by https://fedoraproject.org/wiki/Packaging/SysVInitScript Add --help, as a permitted extension. * daemon/libvirt-guests.init.in (usage): New function. Use it in more places, and return correct value.
This commit is contained in:
parent
9749d94f7b
commit
592277bcff
@ -282,8 +282,21 @@ gueststatus() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# usage [val]
|
||||||
|
# Display usage string, then exit with VAL (defaults to 2).
|
||||||
|
usage() {
|
||||||
|
echo $"Usage: $0 {start|stop|restart|force-reload|gueststatus|shutdown}"
|
||||||
|
exit ${1-2}
|
||||||
|
}
|
||||||
|
|
||||||
# See how we were called.
|
# See how we were called.
|
||||||
|
if test $# != 1; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--help)
|
||||||
|
usage 0
|
||||||
|
;;
|
||||||
start|stop|gueststatus)
|
start|stop|gueststatus)
|
||||||
$1
|
$1
|
||||||
;;
|
;;
|
||||||
@ -304,8 +317,7 @@ case "$1" in
|
|||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo $"Usage: $0 {start|stop|restart|force-reload|gueststatus|shutdown}"
|
usage
|
||||||
exit 3
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user