]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
If select() returns an error, show it to the user.
authorAlan T. DeKok <aland@freeradius.org>
Tue, 15 Mar 2011 08:45:11 +0000 (09:45 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 15 Mar 2011 08:45:11 +0000 (09:45 +0100)
Helps to address bug #149

However, the underlying issue still isn't fixed.  It isn't clear
why select() returns an error.  An alternate solution might be
to simply re-do all of the FD_SET stuff, in the hope that
the cached version was wrong.

src/lib/event.c
src/main/radiusd.c

index 43f938440e7d44788437d21ac3257d66189d7a4e..ab937a546b23325625f67ed7aaba6b185645f586 100644 (file)
@@ -388,8 +388,10 @@ int fr_event_loop(fr_event_list_t *el)
                read_fds = master_fds;
                rcode = select(maxfd + 1, &read_fds, NULL, NULL, wake);
                if ((rcode < 0) && (errno != EINTR)) {
+                       fr_strerror_printf("Failed in select: %s",
+                                          strerror(errno));
                        el->dispatch = 0;
-                       return 0;
+                       return -1;
                }
 
                if (fr_heap_num_elements(el->times) > 0) {
index dd4fec22c414321c98d1dea533e32cf684390a2b..ecd20124c56e5d9ea7ebcd76851b35654bace115 100644 (file)
@@ -407,9 +407,15 @@ int main(int argc, char *argv[])
                radius_stats_init(1);
                hup_mainconfig();
        }
-       
-       radlog(L_INFO, "Exiting normally.");
-       
+
+       if (rcode < 0) {
+               radlog(L_ERR, "Exiting due to internal error: %s",
+                      fr_strerror());
+               rcode = 2;
+       } else {
+               radlog(L_INFO, "Exiting normally.");
+       }
+
        /*
         *      Ignore the TERM signal: we're
         *      about to die.