1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r13677: patch from Max N. Boyarov <m.boyarov@sam-solutions.net>

Prevent div/0 when sysconf(_SC_NPROCESSORS_ONLN) fails.
(This used to be commit 9a33525552)
This commit is contained in:
Gerald Carter 2006-02-24 17:53:25 +00:00 committed by Gerald (Jerry) Carter
parent a0ac1d5913
commit b84c86f7c9

View File

@ -26,7 +26,7 @@ sig_atomic_t keep_running = TRUE;
/* allocates memory and gets numCPUs, total memory, and PerfFreq, number of disks... */
void get_constants(PERF_DATA_BLOCK *data)
{
data->cpuInfo.numCPUs = sysconf(_SC_NPROCESSORS_ONLN);
data->cpuInfo.numCPUs = sysconf(_SC_NPROCESSORS_ONLN) > 0 ? sysconf(_SC_NPROCESSORS_ONLN) : 1;
data->PerfFreq = sysconf(_SC_CLK_TCK);
init_mem_data(data);
init_cpu_data(data);