From: Alan T. DeKok Date: Tue, 15 Mar 2011 08:45:11 +0000 (+0100) Subject: If select() returns an error, show it to the user. X-Git-Tag: release_2_1_11~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b34e2955aabc2e0d67ee5bd38939f4d9b4fe4a77;p=thirdparty%2Ffreeradius-server.git If select() returns an error, show it to the user. 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. --- diff --git a/src/lib/event.c b/src/lib/event.c index 43f938440e7..ab937a546b2 100644 --- a/src/lib/event.c +++ b/src/lib/event.c @@ -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) { diff --git a/src/main/radiusd.c b/src/main/radiusd.c index dd4fec22c41..ecd20124c56 100644 --- a/src/main/radiusd.c +++ b/src/main/radiusd.c @@ -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.