From a6522734ec60a5e3d90ef6b0b8ef86039bd61c3e Mon Sep 17 00:00:00 2001 From: Nate Straz Date: Wed, 14 Feb 2007 16:36:25 +0000 Subject: Every time btimed is restarted we could get a slightly different boot time. qarsh is the primary user of btimed, but it only sends a btime request when it hasn't received output for 5 seconds. If output is streaming for more than 30 seconds, btimed would exit. When the output quiets down again and btimed starts up, it could get a slightly different uptime and round in the opposite direction. --- btimed.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/btimed.c b/btimed.c index 67f9e30..6633967 100644 --- a/btimed.c +++ b/btimed.c @@ -54,9 +54,6 @@ main(int argc, char **argv) /* Running out of (x)inetd the socket was duped onto stdin. */ sd = fileno(stdin); - /* We want to exit after 30 seconds of inactivity */ - alarm(30); - /* Generate the standard btime message */ memset(btimeonly, 0, BTIME_MSGLEN); local_btime = get_btime(); @@ -71,8 +68,8 @@ main(int argc, char **argv) (struct sockaddr *)&cli_addr, &cli_addr_len); if (nbytes < 0) { - /* Bail, we may have had an alarm(), or other error. - * client side resends request, no need to retry here. + /* Bail if we get an error. client side resends + * request, no need to retry here. */ syslog(LOG_INFO, "exitting"); exit(0); @@ -90,8 +87,6 @@ main(int argc, char **argv) sendto(sd, outmsg, BTIME_MSGLEN, MSG_DONTWAIT, (struct sockaddr *)&cli_addr, cli_addr_len); - /* We want to exit after 30 seconds of inactivity */ - alarm(30); } return 0; -- cgit