* [Bug 2804] install-local-data assumes GNU 'find' semantics.
* [Bug 2806] refclock_jjy.c supports the Telephone JJY.
* [Bug 2808] GPSD_JSON driver enhancements, step 1.
+ Fix crash during cleanup if GPS device not present and char device.
Increase internal token buffer to parse all JSON data, even SKY.
Defer logging of errors during driver init until the first unit is
started, so the syslog is not cluttered when the driver is not used.
while ((up = *uscan) != NULL && up->unit != (unit & 0x7F))
uscan = &up->next_unit;
if (up == NULL) {
+ /* alloc unit, add to list and increment use count ASAP. */
up = emalloc_zero(sizeof(*up));
*uscan = up;
+ ++up->refcount;
/* initialize the unit structure */
up->logname = estrdup(refnumtoa(&peer->srcadr));
up->logname, up->device);
goto dev_fail;
}
+ } else {
+ /* All set up, just increment use count. */
+ ++up->refcount;
}
- up->refcount++;
-
+
/* setup refclock processing */
pp->unitptr = (caddr_t)up;
pp->io.fd = -1;
UNUSED_ARG(unit);
- INSIST(up);
+ /* The unit pointer might have been removed already. */
+ if (up == NULL)
+ return;
+
+ /* now check if we must close IO resources */
if (peer != up->pps_peer) {
if (-1 != pp->io.fd) {
DPRINTF(1, ("%s: closing clock, fd=%d\n",
if (up->fdt != -1)
close(up->fdt);
}
+ /* decrement use count and eventually remove this unit. */
if (!--up->refcount) {
/* unlink this unit */
while (*uscan != NULL)