[Git][NTPsec/ntpsec][master] refclock_nmea: better logging of NMEA open fail.

Gary E. Miller gitlab at mg.gitlab.com
Fri Sep 15 02:55:45 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
d64dd503 by Gary E. Miller at 2017-09-15T02:54:59Z
refclock_nmea: better logging of NMEA open fail.

- - - - -


1 changed file:

- ntpd/refclock_nmea.c


Changes:

=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -480,17 +480,18 @@ nmea_start(
 	if ( !peer->cfg.path ) {
             /* build a path */
 	    rcode = snprintf(device, sizeof(device), DEVICE, unit);
-	    if ( 0 <= rcode ) {
-		peer->cfg.path = estrdup( device );
-            } else {
-		pp->io.fd = -1;
-		return false;  /* huh? */
-            }
+	    if ( 0 > rcode ) {
+		/* failed, set to NUL */
+		device[0] = '\0';
+	    }
+	    peer->cfg.path = estrdup( device );
         }
 	/* Open serial port. Use CLK line discipline, if available. */
-	pp->io.fd = refclock_open(device, baudrate, LDISC_CLK);
+	pp->io.fd = refclock_open(peer->cfg.path, baudrate, LDISC_CLK);
 
 	if (0 > pp->io.fd)
+		msyslog(LOG_ERR, "REFCLOCK: %s NMEA device open(%s) failed",
+		    refclock_name(peer), peer->cfg.path);
 		return false;
 
 	LOGIF(CLOCKINFO, (LOG_NOTICE, "%s serial %s open at %s bps",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d64dd5034e049aac894e63c42515d2fe7840d765

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d64dd5034e049aac894e63c42515d2fe7840d765
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170915/2a8b1ca0/attachment.html>


More information about the vc mailing list