[ntp:bk-ntp-stable-send] BitKeeper diffs

Harlan Stenn stenn at deacon.udel.edu
Tue Oct 12 05:07:43 UTC 2010


#### ChangeSet ####
2010-10-12 01:06:48-04:00, stenn at deacon.udel.edu 
  [Bug 750]: Non-existing device causes coredump with RIPE-NCC driver

==== ChangeLog ====
2010-10-12 01:06:32-04:00, stenn at deacon.udel.edu +3 -2
  [Bug 750]: Non-existing device causes coredump with RIPE-NCC driver

--- 1.660/ChangeLog	2010-10-11 23:30:29 -04:00
+++ 1.661/ChangeLog	2010-10-12 01:06:32 -04:00
@@ -1,9 +1,10 @@
 ---
 
-* [Bug 1567] Support Arbiter 1093C Satellite Clock on Windows.
+* [Bug 750]: Non-existing device causes coredump with RIPE-NCC driver.
+* [Bug 1567]: Support Arbiter 1093C Satellite Clock on Windows.
 * [Bug 1643]: Range-check the decoding of the RIPE-NCC status codes.
 * [Bug 1644]: cvo.sh should use lsb_release to identify linux distros.
-* [Bug 1659] Support Truetime Satellite Clocks on Windows.
+* [Bug 1659]: Support Truetime Satellite Clocks on Windows.
 * [Bug 1660]: On some systems, test is in /usr/bin, not /bin.
 * [Bug 1661]: Re-indent refclock_ripencc.c.
 

==== ntpd/refclock_ripencc.c ====
2010-10-12 01:06:33-04:00, stenn at deacon.udel.edu +18 -9
  [Bug 750]: Non-existing device causes coredump with RIPE-NCC driver

--- 1.10/ntpd/refclock_ripencc.c	2010-10-11 23:18:17 -04:00
+++ 1.11/ntpd/refclock_ripencc.c	2010-10-12 01:06:33 -04:00
@@ -471,12 +471,18 @@ ripencc_start(int unit, struct peer *pee
 	struct termios tio;
 	TSIPPKT spt;
 
+	pp = peer->procptr;
+
 	/*
 	 * Open serial port
 	 */
 	(void)snprintf(device, sizeof(device), DEVICE, unit);
-	if (!(fd = refclock_open(device, SPEED232, LDISC_RAW)))
+	if (!(fd = refclock_open(device, SPEED232, LDISC_RAW))) {
+		pp->io.fd = -1;
 		return (0);
+	}
+
+	pp->io.fd = fd;
 
 	/* from refclock_palisade.c */
 	if (tcgetattr(fd, &tio) < 0) {
@@ -503,12 +509,12 @@ ripencc_start(int unit, struct peer *pee
 		return (0);
 	}
 	memset((char *)up, 0, sizeof(struct ripencc_unit));
-	pp = peer->procptr;
+
 	pp->io.clock_recv = ripencc_receive;
 	pp->io.srcclock = (caddr_t)peer;
 	pp->io.datalen = 0;
-	pp->io.fd = fd;
 	if (!io_addclock(&pp->io)) {
+		/* XXX HMS: Do we need to set pp->io.fd to -1 here? */
 		(void) close(fd);
 		free(up);
 		return (0);
@@ -770,12 +776,15 @@ ripencc_shutdown(int unit, struct peer *
 	pp = peer->procptr;
 	up = (struct ripencc_unit *)pp->unitptr;
 
-	if (up->handle != 0)
-		time_pps_destroy(up->handle);
-
-	io_closeclock(&pp->io);
+	if (up != NULL) {
+		if (up->handle != 0)
+			time_pps_destroy(up->handle);
+		free(up);
+	}
+	if (-1 != pp->io.fd)
+		io_closeclock(&pp->io);
 
-	free(up);
+	return;
 }
 
 /*
@@ -1097,7 +1106,7 @@ cmd_0x2F(
 
 /* set serial I/O options */
 void
-md_0x35s(
+cmd_0x35s(
 	 TSIPPKT *cmd,
 	 unsigned char pos_code,
 	 unsigned char vel_code,


More information about the bk-ntp-stable-send mailing list