From a17b87f2bedbd5acc18419a6c471bfd797d2b045 Mon Sep 17 00:00:00 2001 From: Aleksey Izmailov Date: Sun, 14 Feb 2016 13:09:02 +0800 Subject: [PATCH] Fix fork bomb if user is not root, don't try to sudo exec it, just fail. --- writeimage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/writeimage.sh b/writeimage.sh index 8cdc4db02f..c77327ba84 100755 --- a/writeimage.sh +++ b/writeimage.sh @@ -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"