Make fetch_file() function fail on download error

When fetch_file() is used to download a file from a server and the
server returns an error (e.g. 404), bail out immediately. Previously,
we would get an HTML document describing the error and since we didn't
parse it afterwards we would be fooled into thinking that we
successfully downloaded the file. We would then use this HTML document
in place of the targeted file.

Change-Id: Idcbf39040f9937cf55a039086cc93dc0ebead3af
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
diff --git a/utils.sh b/utils.sh
index 51008ff..a145da3 100644
--- a/utils.sh
+++ b/utils.sh
@@ -137,7 +137,7 @@
 		sa="${saveas+-o $saveas}"
 		echo "Fetch: $url -> $saveas"
 		# Use curl to support file protocol
-		curl -sLS $sa "$url"
+		curl --fail -sLS $sa "$url"
 	else
 		sa="${saveas-.}"
 		echo "Fetch: $url -> $sa"