radiusd.c (Is it a bug??)

Leo Lai leolch at hgc.com.hk
Mon Jan 9 12:08:27 CET 2006


when reloading config file, there's a section of code that is supposed 
to wait for all threads to stop, however the condition is like this:
if (!spawn_flag) for(;;) {
   // wait for thread here...
}
when I check where spawn_flag is set, I found that it's TRUE when 
multithread is supported, and FALSE when there is no thread.  In this 
case, shouldn't here be "if (spawn_flag)" instead??

                if (need_reload) {
#ifdef HAVE_PTHREAD_H
            /*
             *    Threads: wait for all threads to stop
             *    processing before re-loading the
             *    config, so we don't pull the rug out
             *    from under them.
             */
                int max_wait = 0;
                if (!spawn_flag) for(;;) {
                    /*
                 * Block until there are '0' threads
                 * with a REQUEST handle.
                 */
                    sig_hup_block = TRUE;
                    if( (total_active_threads() == 0) ||
                     (max_wait >= 5) ) {
                  sig_hup_block = FALSE;
                  break;
                }
                sleep(1);
                max_wait++;
            }
#endif


Thanks,
leo



More information about the Freeradius-Users mailing list