From: Harlan Stenn Date: Sun, 9 Jan 2011 08:32:33 +0000 (+0000) Subject: debug cleanup. Use our stock Version string stuff X-Git-Tag: NTP_4_2_7P131~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e43f85f0deb400fb534d81bfeab609e3eb17348;p=thirdparty%2Fntp.git debug cleanup. Use our stock Version string stuff bk: 4d2972a1qNqJE6tYowLMSi_4br-xmw --- diff --git a/sntp/Makefile.am b/sntp/Makefile.am index f0e580975..7d981444b 100644 --- a/sntp/Makefile.am +++ b/sntp/Makefile.am @@ -15,7 +15,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/../lib/isc/unix/include \ $(NULL) -LDADD = $(LIBOPTS_LDADD) $(LIBEVENT_LDADD) $(LIBM) ../libntp/libntp.a @LCRYPTO@ +LDADD = version.o $(LIBOPTS_LDADD) $(LIBEVENT_LDADD) $(LIBM) ../libntp/libntp.a @LCRYPTO@ run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \ autogen -L ../include --writable @@ -60,6 +60,10 @@ sntp_SOURCES = \ utilities.h \ $(NULL) +DISTCLEANFILES = \ + version.c \ + $(NULL) + EXTRA_DIST = \ $(srcdir)/autogen-version.def \ bincheck.mf \ @@ -73,6 +77,7 @@ EXTRA_DIST = \ sntp.html \ sntp.texi \ tests_main.h \ + $(srcdir)/version \ $(srcdir)/version.def \ $(srcdir)/version.m4 \ $(srcdir)/version.texi \ @@ -90,6 +95,7 @@ BUILT_SOURCES= \ libtool \ $(srcdir)/sntp-opts.c \ $(srcdir)/sntp-opts.h \ + $(srcdir)/version \ $(NULL) man_MANS= $(srcdir)/sntp.1 @@ -111,6 +117,17 @@ FRC: @: similarly always be outdated causing their rules to fire @: each time they or a dependent is built. +$(srcdir)/version: FRC + @cd $(srcdir) \ + && test -f ../version \ + && ( cd .. && $(MAKE) version ) \ + && ( cmp -s version ../version || cp ../version version ) + +# We probably need something about libevent, too +version.o: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version + env CSET=`cat $(top_srcdir)/version` ../$(top_builddir)/scripts/mkver sntp + $(COMPILE) -c version.c + check-autogen-version.def: FRC @cd $(srcdir) \ && test -r ../include/autogen-version.def \ diff --git a/sntp/networking.c b/sntp/networking.c index 5ae94f15f..36a83c8d2 100644 --- a/sntp/networking.c +++ b/sntp/networking.c @@ -58,7 +58,7 @@ resolve_hosts ( : "(AAAA) ", hosts[a], gai_strerror(error)); } else { -#ifdef DEBUG +#if 0 for (dres = tres[resc]; dres; dres = dres->ai_next) { getnameinfo(dres->ai_addr, dres->ai_addrlen, adr_buf, sizeof(adr_buf), NULL, 0, NI_NUMERICHOST); STDLINE @@ -109,13 +109,15 @@ sendpkt ( int cc; #ifdef DEBUG - printf("sntp sendpkt: Packet data:\n"); - pkt_output(pkt, len, stdout); -#endif + if (debug > 2) { + printf("sntp sendpkt: Packet data:\n"); + pkt_output(pkt, len, stdout); + } if (debug) { printf("sntp sendpkt: Sending packet to %s ...\n", sptoa(dest)); } +#endif cc = sendto(rsock, (void *)pkt, len, 0, &dest->sa, SOCKLEN(dest)); if (cc == SOCKET_ERROR) { @@ -125,8 +127,11 @@ sendpkt ( if (errno != EWOULDBLOCK && errno != ENOBUFS) { /* oh well */ } - } else if (debug) { - printf("Packet sent.\n"); + } else { +#ifdef DEBUG + if (debug) + printf("Packet sent.\n"); +#endif } } @@ -154,9 +159,9 @@ recvdata( printf("Received %d bytes from %s:\n", recvc, sptoa(sender)); pkt_output((struct pkt *) rdata, recvc, stdout); } else { - saved_errno = errno; + // saved_errno = errno; printf("recvfrom error %d (%s)\n", errno, strerror(errno)); - errno = saved_errno; + // errno = saved_errno; } #endif return recvc;