Re: [ANNOUNCE] util-linux v2.26-rc1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Here is a fix for systems which don't have sys/timex.h and its
ntp_gettime().

Samuel
diff --git a/configure.ac b/configure.ac
index 3d77307..fce7e0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,6 +230,7 @@ AC_CHECK_HEADERS([ \
 	sys/swap.h \
 	sys/syscall.h \
 	sys/time.h \
+	sys/timex.h \
 	sys/ttydefaults.h \
 	sys/types.h \
 	sys/un.h \
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 35caf9d..6be6033 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -44,7 +44,9 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
+#ifdef HAVE_SYS_TIMEX_H
 #include <sys/timex.h>
+#endif
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -325,7 +327,9 @@ static void syslog_rfc5424(const  struct logger_ctl *ctl, const char *msg)
 {
 	char *buf, *tag = NULL, *hostname = NULL;
 	char pid[32], time[64], timeq[80];
+#ifdef HAVE_SYS_TIMEX_H
 	struct ntptimeval ntptv;
+#endif
 	struct timeval tv;
 	struct tm *tm;
 	int len;
@@ -363,6 +367,7 @@ static void syslog_rfc5424(const  struct logger_ctl *ctl, const char *msg)
 	if (ctl->pid)
 		snprintf(pid, sizeof(pid), " %d", ctl->pid);
 
+#ifdef HAVE_SYS_TIMEX_H
 	if (ctl->rfc5424_tq) {
 		if (ntp_gettime(&ntptv) == TIME_OK)
 			snprintf(timeq, sizeof(timeq),
@@ -372,6 +377,7 @@ static void syslog_rfc5424(const  struct logger_ctl *ctl, const char *msg)
 			snprintf(timeq, sizeof(timeq),
 				 " [timeQuality tzKnown=\"1\" isSynced=\"0\"]");
 	}
+#endif
 
 	len = xasprintf(&buf, "<%d>1%s%s%s %s -%s%s %s", ctl->pri, time,
 		  hostname ? " " : "",

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux