Fix %{getncpus proc/thread} potentially returning zero
Add the missing sanity check/fixup for memory starved systems where
we end up returning zero cpus. Should've been in commit
deaebd0c89
originally.
Reported in https://issues.redhat.com/browse/RHEL-16557
This commit is contained in:
parent
0091214d2f
commit
6714ec7068
|
@ -1253,6 +1253,9 @@ static void doGetncpus(rpmMacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *pa
|
|||
if (mcpus < ncpus)
|
||||
ncpus = mcpus;
|
||||
}
|
||||
/* Ensure at least one CPU, no matter how starved */
|
||||
if (ncpus < 1)
|
||||
ncpus = 1;
|
||||
|
||||
sprintf(buf, "%u", ncpus);
|
||||
rpmMacroBufAppendStr(mb, buf);
|
||||
|
|
Loading…
Reference in New Issue