From a6a6e0be2c847f14ce983ce817f27606299c29eb Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 17 Feb 2021 09:52:48 +0100 Subject: [PATCH] common: Make sure that NUM_JOBS is a positive integer --- common.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common.sh b/common.sh index 014b257307..a97c560fe8 100644 --- a/common.sh +++ b/common.sh @@ -8,7 +8,10 @@ # The number of jobs to pass to tools that can run in parallel (such as make # and dpkg-buildpackage -if [[ -z ${NUM_JOBS} ]]; then +case "${NUM_JOBS}" in + *[!0-9]*) NUM_JOBS='' ;; +esac +if [[ -z ${NUM_JOBS} ]] || [[ ${NUM_JOBS} -eq 0 ]]; then NUM_JOBS=$(grep -c "^processor" /proc/cpuinfo) fi # Ensure that any sub scripts we invoke get the max proc count.