]> sourceware.org Git - systemtap.git/commitdiff
stapbpf.cxx sysconf() coverity nit
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 9 May 2019 13:22:08 +0000 (09:22 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Thu, 9 May 2019 13:22:08 +0000 (09:22 -0400)
stapbpf/stapbpf.cxx

index 22faefe2559a6424e2394b4defdd66cd4881c4e3..d9aec03fe0976eaaed9e22e23930fa4581f91ffa 100644 (file)
@@ -368,7 +368,8 @@ instantiate_maps (Elf64_Shdr *shdr, Elf_Data *data)
           // (while sizing the perf_event_map according to total CPUs).
           // But for full coverage, we really need to listen to CPUs
           // coming on/offline and adjust accordingly.
-          unsigned ncpus = sysconf(_SC_NPROCESSORS_CONF);
+          long ncpus_ = sysconf(_SC_NPROCESSORS_CONF);
+          unsigned ncpus = ncpus_ > 0 ? ncpus_ : 1;
           //unsigned ncpus = get_nprocs_conf();
           mark_active_cpus(ncpus);
           attrs[i].max_entries = ncpus;
This page took 0.029947 seconds and 5 git commands to generate.