]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use '0' to mean error
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 May 2023 22:22:57 +0000 (18:22 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 31 May 2023 22:22:57 +0000 (18:22 -0400)
src/lib/server/main_config.c
src/lib/util/hw.c

index a1377ac0a40e49e6535d0fccff198dd7ee4787e2..a8bfc3efdbf81c80e457a4a0797985c5b8198e1a 100644 (file)
@@ -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;
        }
index cdb7fccad8e2d446c6d01e1eaf87753bf3377945..befa44e7f5ec6c66285a62b27aebdba4e7a00bfc 100644 (file)
@@ -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);