]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: check for ntp_gettime() rather than for timex.h
authorKarel Zak <kzak@redhat.com>
Tue, 10 Mar 2015 10:37:45 +0000 (11:37 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Mar 2015 09:21:38 +0000 (10:21 +0100)
It seems that musl libc and uClibc without UCLIBC_NTP_LEGACY
does not provide ntp_gettime and compile will fail.

References: https://github.com/karelzak/util-linux/issues/174
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
misc-utils/logger.c

index 122b5d532c6e453d2b8a66afc9e7fe91a30e4454..421aedc9bccf063dbde5488d035eb81eab257fbe 100644 (file)
@@ -343,6 +343,7 @@ AC_CHECK_FUNCS([ \
        lseek64 \
        mempcpy \
        nanosleep \
+       ntp_gettime \
        open_memstream \
        personality \
        posix_fadvise \
index 0a9e4ab57d6abd535f364c7c0006cb42f31054eb..2fd3ddf1dc38e104ebb0298dc4fe7063756306a9 100644 (file)
@@ -366,9 +366,6 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl)
 {
        char *hostname = NULL;
        char pid[32], time[64], timeq[80];
-#ifdef HAVE_SYS_TIMEX_H
-       struct ntptimeval ntptv;
-#endif
        struct timeval tv;
        struct tm *tm;
 
@@ -408,7 +405,9 @@ static void syslog_rfc5424_header(struct logger_ctl *const ctl)
                snprintf(pid, sizeof(pid), " %d", ctl->pid);
 
        if (ctl->rfc5424_tq) {
-#ifdef HAVE_SYS_TIMEX_H
+#ifdef HAVE_NTP_GETTIME
+               struct ntptimeval ntptv;
+
                if (ntp_gettime(&ntptv) == TIME_OK)
                        snprintf(timeq, sizeof(timeq),
                                 " [timeQuality tzKnown=\"1\" isSynced=\"1\" syncAccuracy=\"%ld\"]",