diff options
Diffstat (limited to 'contrib/ntp/ntpdate/ntptimeset.c')
-rw-r--r-- | contrib/ntp/ntpdate/ntptimeset.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/contrib/ntp/ntpdate/ntptimeset.c b/contrib/ntp/ntpdate/ntptimeset.c index 6d9332f..2485aad 100644 --- a/contrib/ntp/ntpdate/ntptimeset.c +++ b/contrib/ntp/ntpdate/ntptimeset.c @@ -141,7 +141,6 @@ #include <signal.h> #include <ctype.h> #ifndef SYS_WINNT -# include <netdb.h> # ifdef HAVE_SYS_SIGNAL_H # include <sys/signal.h> # else @@ -403,7 +402,7 @@ ntptimesetmain( ) { int was_alarmed; - struct recvbuf *rbuflist; + int tot_recvbufs; struct recvbuf *rbuf; l_fp tmp; int errflg; @@ -646,7 +645,6 @@ ntptimesetmain( * yet to learn about anything else that is. */ was_alarmed = 0; - rbuflist = (struct recvbuf *)0; while (finish_time > current_time) { #if !defined(HAVE_SIGNALED_IO) fd_set rdfdes; @@ -655,7 +653,7 @@ ntptimesetmain( block_io_and_alarm(); #endif - rbuflist = getrecvbufs(); /* get received buffers */ + tot_recvbufs = full_recvbuffs(); /* get received buffers */ if (printmsg) { printmsg = 0; analysis(0); @@ -665,7 +663,7 @@ ntptimesetmain( alarm_flag = 0; } - if (!was_alarmed && rbuflist == (struct recvbuf *)0) { + if (!was_alarmed && tot_recvbufs > 0) { /* * Nothing to do. Wait for something. */ @@ -705,7 +703,7 @@ ntptimesetmain( was_alarmed = 1; alarm_flag = 0; } - rbuflist = getrecvbufs(); /* get received buffers */ + tot_recvbufs = full_recvbuffs(); /* get received buffers */ } #ifdef HAVE_SIGNALED_IO unblock_io_and_alarm(); @@ -725,18 +723,13 @@ ntptimesetmain( * Call the data procedure to handle each received * packet. */ - while (rbuflist != (struct recvbuf *)0) + rbuf = get_full_recv_buffer(); + while (rbuf != NULL) { - rbuf = rbuflist; - rbuflist = rbuf->next; receive(rbuf); freerecvbuf(rbuf); + rbuf = get_full_recv_buffer(); } -#if defined DEBUG && defined SYS_WINNT - if (debug > 4) - printf("getrecvbufs: %ld handler interrupts, %ld frames\n", - handler_calls, handler_pkts); -#endif /* * Do we have enough information to stop now? |