diff options
author | Gerald Carter <jerry@samba.org> | 2006-02-24 17:53:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:22 -0500 |
commit | b84c86f7c99ee8671d134f792b1dbbfe89ca368f (patch) | |
tree | 4fb84a739300cbd2ec26c2e0f0a27c27d166cb87 /examples/perfcounter | |
parent | a0ac1d5913ad182abe63d1076b775d1d6dac3365 (diff) | |
download | samba-b84c86f7c99ee8671d134f792b1dbbfe89ca368f.tar.gz samba-b84c86f7c99ee8671d134f792b1dbbfe89ca368f.tar.bz2 samba-b84c86f7c99ee8671d134f792b1dbbfe89ca368f.zip |
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 9a335255529d0e93dabbb6b0910f10fa162f9d4a)
Diffstat (limited to 'examples/perfcounter')
-rw-r--r-- | examples/perfcounter/perf_writer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/perfcounter/perf_writer.c b/examples/perfcounter/perf_writer.c index 04127f5621..00e47bdaba 100644 --- a/examples/perfcounter/perf_writer.c +++ b/examples/perfcounter/perf_writer.c @@ -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); |