[ntp:questions] Re: Host found message incorrect

jpd read_the_sig at do.not.spam.it
Fri Jan 16 14:58:57 UTC 2004

In article <4006D509.F2142113 at udel.edu>, David L. Mills wrote:
[snip: misleading host found in ntpdate]
> I lied. That message was added to ntpdate.c without my knowledge. In any
> case, ntpdate.c is a dead puppy, as much better and more reliable
> functionality is available in ntpd.

That is unfortunate, as many ``stock'' distributions still make it far
too easy or just default to doing an ntpdate -b $server before starting
the server.

I'm not that familiar with the usually correct but not always very clear
ntp documentation, so I might not have noticed if it's in there, but how
does one duplicate ntpdate -b without ntpdate?

> As I said, you will need to contact
> whoever modified the sources.

How does one find out who put it in? Is there a source control system?
I'm willing to provide a patch ripping the message out again. :-)

*** start patch
--- ntpdate.c.orig	Fri Jan 16 15:48:50 2004
+++ ntpdate.c	Fri Jan 16 15:51:54 2004
@@ -1339,7 +1339,7 @@
         hints.ai_family = ai_fam_templ;
         hints.ai_socktype = SOCK_DGRAM;
-        printf("Looking for host %s and service %s\n", serv, service);
+        if(debug) printf("Looking for host %s and service %s\n", serv, service);
         error = getaddrinfo(serv, service, &hints, &addrResult);
         if (error != 0) {
@@ -1348,7 +1348,7 @@
         else {
-                fprintf(stderr, "host found : %s\n", stohost((struct sockaddr_storage*)addrResult->ai_addr));
+                if(debug) printf("host found : %s\n", stohost((struct sockaddr_storage*)addrResult->ai_addr));
 	server = (struct server *)emalloc(sizeof(struct server));
*** end patch

It looks like a debug diagnostic (it's not an error condition) printing
to stderr made it into a production release. So I if(debug)'ed it out.

  j p d (at) d s b (dot) t u d e l f t (dot) n l .

More information about the questions mailing list