Fix fork bomb if user is not root, don't try to sudo exec it, just fail.

This commit is contained in:
Aleksey Izmailov 2016-02-14 13:09:02 +08:00
parent 99fb50b2a6
commit a17b87f2be

View File

@ -16,7 +16,7 @@ if [ -z "$1" ]; then
usage
fi
test "root" != "$USER" && exec sudo $0 "$@"
if [[ $(id -u) -ne 0 ]]; then echo "Please run as root"; exit 1; fi
function msg() {
echo ":: $1"