[Git][NTPsec/ntpsec][master] 2 commits: Abolish yet another lvalue use of lfpuint()

Eric S. Raymond gitlab at mg.gitlab.com
Sat Dec 31 21:51:40 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
ca0b4f77 by Eric S. Raymond at 2016-12-31T12:34:42-05:00
Abolish yet another lvalue use of lfpuint()

- - - - -
ff32d00c by Eric S. Raymond at 2016-12-31T16:51:29-05:00
Address GitLab issue #122: ntpmon in VT100 terminal emulator crashes

- - - - -


2 changed files:

- ntpclients/ntpmon
- ntpd/ntp_util.c


Changes:

=====================================
ntpclients/ntpmon
=====================================
--- a/ntpclients/ntpmon
+++ b/ntpclients/ntpmon
@@ -103,7 +103,11 @@ class OutputContext:
         "Begin critical region."
         global stdscr
         stdscr = curses.initscr()
-        curses.curs_set(0)
+        try:
+            curses.curs_set(0)
+        except curses.error:
+            # VT100 terminal emulations can barf here.
+            pass
         curses.cbreak()
         curses.noecho()
         stdscr.keypad(True)


=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -383,7 +383,7 @@ record_peer_stats(
 	get_systime(&now);
 	filegen_setup(&peerstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (peerstats.fp != NULL) {
 		fprintf(peerstats.fp,
 		    "%lu %s %s %x %.9f %.9f %.9f %.9f\n", day,
@@ -434,7 +434,7 @@ record_loop_stats(
 	get_systime(&now);
 	filegen_setup(&loopstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (loopstats.fp != NULL) {
 		fprintf(loopstats.fp, "%lu %s %.9f %.3f %.9f %.6f %d\n",
 		    day, ulfptoa(now, 3), offset, freq * 1e6, jitter,
@@ -468,7 +468,7 @@ record_clock_stats(
 	get_systime(&now);
 	filegen_setup(&clockstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (clockstats.fp != NULL) {
 		fprintf(clockstats.fp, "%lu %s %s %s\n", day,
 		    ulfptoa(now, 3), peerlabel(peer), text);
@@ -541,7 +541,7 @@ record_raw_stats(
 	get_systime(&now);
 	filegen_setup(&rawstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (rawstats.fp != NULL) {
 		fprintf(rawstats.fp, "%lu %s %s %s %s %s %s %s %d %d %d %d %d %d %.6f %.6f %s %d\n",
 		    day, ulfptoa(now, 3),
@@ -586,7 +586,7 @@ record_sys_stats(void)
 	get_systime(&now);
 	filegen_setup(&sysstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (sysstats.fp != NULL) {
 		fprintf(sysstats.fp,
 		    "%lu %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
@@ -625,7 +625,7 @@ void record_use_stats(void)
 	get_systime(&now);
 	filegen_setup(&usestats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (usestats.fp != NULL) {
 		double utime, stime;
 		getrusage(RUSAGE_SELF, &usage);
@@ -678,7 +678,7 @@ record_proto_stats(
 	get_systime(&now);
 	filegen_setup(&protostats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (protostats.fp != NULL) {
 		fprintf(protostats.fp, "%lu %s %s\n", day,
 		    ulfptoa(now, 3), str);
@@ -710,7 +710,7 @@ record_timing_stats(
 	get_systime(&now);
 	filegen_setup(&timingstats, lfpuint(now));
 	day = lfpuint(now) / 86400 + MJD_1900;
-	lfpuint(now) %= 86400;
+	setlfpuint(now, lfpuint(now) % 86400);
 	if (timingstats.fp != NULL) {
 		fprintf(timingstats.fp, "%lu %s %s\n", day, lfptoa(now,
 		    3), text);



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c731bd52ed327a063aab0ff650b58eb30b3acf74...ff32d00c7642dedaab4ee5b0b0f7d886444bf109
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161231/7eef81ad/attachment.html>


More information about the vc mailing list