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

« back to all changes in this revision

Viewing changes to ntpd/refclock_trak.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:
147
147
         * timestamp following the "*" on-time character of the
148
148
         * timecode.
149
149
         */
150
 
        (void)sprintf(device, DEVICE, unit);
 
150
        snprintf(device, sizeof(device), DEVICE, unit);
151
151
        if (
152
152
#ifdef PPS
153
153
                !(fd = refclock_open(device, SPEED232, LDISC_CLK))
160
160
        /*
161
161
         * Allocate and initialize unit structure
162
162
         */
163
 
        if (!(up = (struct trakunit *)
164
 
              emalloc(sizeof(struct trakunit)))) {
165
 
                (void) close(fd);
166
 
                return (0);
167
 
        }
168
 
        memset((char *)up, 0, sizeof(struct trakunit));
 
163
        up = emalloc(sizeof(*up));
 
164
        memset(up, 0, sizeof(*up));
169
165
        pp = peer->procptr;
170
166
        pp->io.clock_recv = trak_receive;
171
167
        pp->io.srcclock = (caddr_t)peer;
173
169
        pp->io.fd = fd;
174
170
        if (!io_addclock(&pp->io)) {
175
171
                (void) close(fd);
 
172
                pp->io.fd = -1;
176
173
                free(up);
177
174
                return (0);
178
175
        }
214
211
 
215
212
        pp = peer->procptr;
216
213
        up = (struct trakunit *)pp->unitptr;
217
 
        io_closeclock(&pp->io);
218
 
        free(up);
 
214
        if (-1 != pp->io.fd)
 
215
                io_closeclock(&pp->io);
 
216
        if (NULL != up)
 
217
                free(up);
219
218
}
220
219
 
221
220