From: Arran Cudbard-Bell Date: Wed, 31 May 2023 22:22:57 +0000 (-0400) Subject: Use '0' to mean error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b920137ff971cb34ee1c440f2392124e202370f;p=thirdparty%2Ffreeradius-server.git Use '0' to mean error --- diff --git a/src/lib/server/main_config.c b/src/lib/server/main_config.c index a1377ac0a40..a8bfc3efdbf 100644 --- a/src/lib/server/main_config.c +++ b/src/lib/server/main_config.c @@ -453,7 +453,7 @@ static int num_workers_dflt(CONF_PAIR **out, void *parent, CONF_SECTION *cs, fr_ main_config_t *conf = parent; value = fr_hw_num_cores_active(); - if (value < 0) { + if (value == 0) { cf_log_pwarn(parent, "Failed retrieving core count, defaulting to 1 worker"); value = 1; } diff --git a/src/lib/util/hw.c b/src/lib/util/hw.c index cdb7fccad8e..befa44e7f5e 100644 --- a/src/lib/util/hw.c +++ b/src/lib/util/hw.c @@ -101,14 +101,14 @@ uint32_t fr_hw_num_cores_active(void) */ if (unlikely((tsibs == 0) || (lcores == 0) || (lcores > tsibs))) { fr_strerror_printf("Failed retrieving cpu topology info: %s", fr_syserror(errno)); - return -1; + return 0; } #ifdef STATIC_ANALYZER /* * Prevent static analyzer from warning about divide by zero */ - if ((tsibs / lcores) == 0) return -1; + if ((tsibs / lcores) == 0) return 0; #endif return lcores / (tsibs / lcores);