[Git][NTPsec/ntpsec][master] Fix generic refclock logging.

Eric S. Raymond gitlab at mg.gitlab.com
Sat Sep 16 17:19:37 UTC 2017


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


Commits:
f9a94698 by Eric S. Raymond at 2017-09-16T17:19:22Z
Fix generic refclock logging.

- - - - -


1 changed file:

- ntpd/refclock_generic.c


Changes:

=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -2510,6 +2510,7 @@ parse_start(
 	char parseppsdev[sizeof(PARSEPPSDEVICE)+20];
 	parsectl_t tmp_ctl;
 	unsigned int type;
+	char *path, *ppspath;
 
 	UNUSED_ARG(sysunit);
 
@@ -2542,17 +2543,26 @@ parse_start(
 	/*
 	 * Unit okay, attempt to open the device.
 	 */
-	(void) snprintf(parsedev, sizeof(parsedev), PARSEDEVICE, unit);
-	(void) snprintf(parseppsdev, sizeof(parsedev), PARSEPPSDEVICE, unit);
+	if (peer->cfg.path)
+	    path = peer->cfg.path;
+	else {
+	    (void) snprintf(parsedev, sizeof(parsedev), PARSEDEVICE, unit);
+	    path = parsedev;
+	}
+	if (peer->cfg.ppspath)
+	    ppspath = peer->cfg.ppspath;
+	else { 
+	    (void) snprintf(parseppsdev, sizeof(parsedev), PARSEPPSDEVICE, unit);
+	    ppspath = parseppsdev;
+	}
 
-	fd232 = open(peer->cfg.path ? peer->cfg.path : parsedev,
-			 O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
+	fd232 = open(path, O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
 
 	if (fd232 == -1)
 	{
 		msyslog(LOG_ERR,
                         "REFCLOCK: PARSE receiver #%u: parse_start: open of %s failed: %m",
-                        unit, parsedev);
+                        unit, path);
 		return false;
 	}
 
@@ -2668,7 +2678,7 @@ parse_start(
 		 * if the PARSEPPSDEVICE can be opened that will be used
 		 * for PPS else PARSEDEVICE will be used
 		 */
-		parse->ppsfd = open(parseppsdev, O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
+		parse->ppsfd = open(ppspath, O_RDWR | O_NOCTTY | O_NONBLOCK, 0777);
 
 		if (parse->ppsfd == -1)
 		{



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f9a946983dd80a57726eeb6fb5b953eb97ac77be
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/20170916/03a6f502/attachment.html>


More information about the vc mailing list