~ubuntu-branches/debian/squeeze/ntp/squeeze

« back to all changes in this revision

Viewing changes to ntpd/refclock_wwvb.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2010-05-24 11:09:51 UTC
  • mfrom: (1.2.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100524110951-1o7gh469ygochf4n
Tags: 1:4.2.6.p1+dfsg-1
* New upstream version
  - They no longer ship arlib, adjust dfsg.patch.
  - Drop kfreebsd.patch, applied upstream
  - Update patches for upstream changes.
* Remove the obsolete config files:

  for ntp:
  - /etc/logcheck/ignore.d.server/ntp, removed in 1:4.2.6+dfsg-1
  - /etc/dhcp3/dhclient-enter-hooks.d/ntp, replaced by exit hooks in
    1:4.2.4p4+dfsg-3
  - /etc/network/if-up.d/ntp, removed in 1:4.2.4p0+dfsg-1

  for ntpdate:
  - /etc/dhcp3/dhclient-enter-hooks.d/ntpdate, replaced by exit hooks in
    1:4.2.4p4+dfsg-3

  Use dpkg 1.15.7.2's dpkg-maintscript-helper.  This needs
  a Pre-Depends to work, else it's never going to be removed.
  (Closes: #569530)
* Add "Depends: ${misc:Depends}" to ntp-doc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
        /*
189
189
         * Open serial port. Use CLK line discipline, if available.
190
190
         */
191
 
        sprintf(device, DEVICE, unit);
192
 
        if (-1 == (fd = refclock_open(device, SPEED232, LDISC_CLK)))
 
191
        snprintf(device, sizeof(device), DEVICE, unit);
 
192
        if (0 == (fd = refclock_open(device, SPEED232, LDISC_CLK)))
193
193
                return (0);
194
194
 
195
195
        /*
196
196
         * Allocate and initialize unit structure
197
197
         */
198
 
        up = (struct wwvbunit *)emalloc(sizeof(struct wwvbunit));
199
 
        memset((char *)up, 0, sizeof(struct wwvbunit));
 
198
        up = emalloc(sizeof(*up));
 
199
        memset(up, 0, sizeof(*up));
200
200
        pp = peer->procptr;
201
201
        pp->unitptr = (caddr_t)up;
202
202
        pp->io.clock_recv = wwvb_receive;
205
205
        pp->io.fd = fd;
206
206
        if (!io_addclock(&pp->io)) {
207
207
                close(fd);
 
208
                pp->io.fd = -1;
208
209
                free(up);
 
210
                pp->unitptr = NULL;
209
211
                return (0);
210
212
        }
211
213
 
214
216
         */
215
217
        peer->precision = PRECISION;
216
218
        pp->clockdesc = DESCRIPTION;
217
 
        memcpy((char *)&pp->refid, REFID, 4);
 
219
        memcpy(&pp->refid, REFID, 4);
218
220
        return (1);
219
221
}
220
222
 
233
235
 
234
236
        pp = peer->procptr;
235
237
        up = (struct wwvbunit *)pp->unitptr;
236
 
        io_closeclock(&pp->io);
237
 
        free(up);
 
238
        if (-1 != pp->io.fd)
 
239
                io_closeclock(&pp->io);
 
240
        if (NULL != up)
 
241
                free(up);
238
242
}
239
243
 
240
244