[Git][NTPsec/ntpsec][master] 2 commits: Build without utmpx.h

Hal Murray gitlab at mg.gitlab.com
Sat Feb 6 19:32:04 UTC 2016


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
fc1eaf94 by Hal Murray at 2016-02-06T10:31:19-08:00
Build without utmpx.h

- - - - -
fa1cc41a by Hal Murray at 2016-02-06T10:37:33-08:00
Fix typo

- - - - -


2 changed files:

- libntp/systime.c
- pylib/configure.py


Changes:

=====================================
libntp/systime.c
=====================================
--- a/libntp/systime.c
+++ b/libntp/systime.c
@@ -15,8 +15,9 @@
 #include "timespecops.h"
 #include "ntp_calendar.h"
 
+#ifdef HAVE_UTMPX_H
 #include <utmpx.h>
-
+#endif
 
 #ifndef USE_COMPILETIME_PIVOT
 # define USE_COMPILETIME_PIVOT 1
@@ -449,21 +450,22 @@ step_systime(
 	timetv.tv_usec = timets.tv_nsec / 1000;
 	tvdiff = abs_tval(sub_tval(timetv, tvlast));
 	if (tvdiff.tv_sec > 0) {
-#ifdef OVERRIDE_OTIME_MSG
-# define OTIME_MSG OVERRIDE_OTIME_MSG
-#else
+#ifdef HAVE_UTMPX_H
+# ifdef OVERRIDE_OTIME_MSG
+#  define OTIME_MSG OVERRIDE_OTIME_MSG
+# else
 /* Already defined on NetBSD */
-# ifndef OTIME_MSG
-#  define OTIME_MSG	"Old NTP time"
+#  ifndef OTIME_MSG
+#   define OTIME_MSG	"Old NTP time"
+#  endif
 # endif
-#endif
-#ifdef OVERRIDE_NTIME_MSG
-# define NTIME_MSG OVERRIDE_NTIME_MSG
-#else
-# ifndef NTIME_MSG
-#  define NTIME_MSG	"New NTP time"
+# ifdef OVERRIDE_NTIME_MSG
+#  define NTIME_MSG OVERRIDE_NTIME_MSG
+# else
+#  ifndef NTIME_MSG
+#   define NTIME_MSG	"New NTP time"
+#  endif
 # endif
-#endif
 		struct utmpx utx;
 
 		ZERO(utx);
@@ -484,8 +486,8 @@ step_systime(
 		endutxent();
 
 		/* Not POSIX - glibc extension */
-#ifdef HAVE_UPDWTMPX
-#define WTMPX_FILE "/var/log/wtmp"
+# ifdef HAVE_UPDWTMPX
+# define WTMPX_FILE "/var/log/wtmp"
 		/* WTMPX */
 		utx.ut_type = OLD_TIME;
 		utx.ut_tv.tv_sec = tvlast.tv_sec;
@@ -497,10 +499,11 @@ step_systime(
 		utx.ut_tv.tv_usec = timetv.tv_usec;
 		strlcpy(utx.ut_line, NTIME_MSG, sizeof(utx.ut_line));
 		updwtmpx(WTMPX_FILE, &utx);
-#undef WTMPX_FILE
-#endif /* HAVE_UPDWTMPX */
-#undef OTIME_MSG
-#undef NTIME_MSG
+# undef WTMPX_FILE
+# endif /* HAVE_UPDWTMPX */
+# undef OTIME_MSG
+# undef NTIME_MSG
+#endif
 	}
 	tvlast = timetv;
 	return true;


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -343,6 +343,7 @@ def cmd_configure(ctx):
 #HGM		"sys/systune.h",
 		("timepps.h", ["inttypes.h"]),
 		("sys/timepps.h", ["inttypes.h", "sys/time.h"]),
+		"utmpx.h"       # missing on RTEMS and OpenBSD
 	)
 	for hdr in optional_headers:
 		if type(hdr) == type(""):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b88776e15b23758f9413297c6359d6187e887778...fa1cc41ad5b69f129d143c9f7a8ddbb532052acc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160206/a7e1393b/attachment.html>


More information about the vc mailing list