From: Todd C. Miller Date: Wed, 3 Aug 2016 12:31:17 +0000 (-0600) Subject: Use /proc/cpuinfo on Linux instead of running lscpu X-Git-Tag: SUDO_1_8_18^2~89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14c9d203e892e74745505acd7a1d2323fd42cfde;p=sudo Use /proc/cpuinfo on Linux instead of running lscpu --- diff --git a/mkpkg b/mkpkg index ab10cd768..c398b0883 100755 --- a/mkpkg +++ b/mkpkg @@ -94,15 +94,17 @@ osrelease=`echo "$osversion" | sed -e 's/^[^0-9]*//' -e 's/-.*$//'` # If using GNU make, set number of jobs if make --version 2>&1 | grep GNU >/dev/null; then - NJOBS=1 + NJOBS=0 case "`uname`" in Darwin) # Mac OS X NJOBS=`sysctl -n hw.ncpu` ;; Linux) - if [ -x /usr/bin/lscpu ]; then - NJOBS=`/usr/bin/lscpu -p=cpu | grep -v '^#' | wc -l` + if [ -r /proc/cpuinfo ]; then + for c in `sed -n 's/^cpu cores[ ]*: *//p' /proc/cpuinfo`; do + NJOBS=$(( $NJOBS + $c )) + done fi ;; SunOS)