]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
v4: Two CI fixes (#4229)
authorNick Porter <nick@portercomputing.co.uk>
Thu, 16 Sep 2021 12:45:02 +0000 (13:45 +0100)
committerGitHub <noreply@github.com>
Thu, 16 Sep 2021 12:45:02 +0000 (08:45 -0400)
* sysctl.h is deprecated on Linux - and not needed here

* Prevent invalid divide by zero warnings

src/lib/server/main_config.c
src/lib/util/hw.c

index 944520ff6bf66c7d4b64d9dcb51febc927077574..8031c183a81ee99965d1acf9ebf92613766e3de7 100644 (file)
@@ -50,7 +50,6 @@ RCSID("$Id$")
 
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/sysctl.h>
 
 #ifdef HAVE_SYSLOG_H
 #  include <syslog.h>
index 9603726ed55eec9aa1118466908835f4aa75346f..3fe36e780f4964e18eb4ea302d671504fb951e7a 100644 (file)
@@ -90,7 +90,11 @@ uint32_t fr_hw_num_cores_active(void)
                 fclose(cpu);
         }
 
-       return lcores / (tsibs / lcores);
+       /*
+        *      Prevent clang scanner from warning about divide by zero
+        */
+       tsibs = tsibs / (lcores ? lcores : 1);
+       return lcores / (tsibs ? tsibs : 1);
 }
 #else
 size_t fr_hw_cache_line_size(void)