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

« back to all changes in this revision

Viewing changes to ntpd/refclock_as2201.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:
165
165
        /*
166
166
         * Open serial port. Use CLK line discipline, if available.
167
167
         */
168
 
        (void)sprintf(gpsdev, DEVICE, unit);
 
168
        snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit);
169
169
        if (!(fd = refclock_open(gpsdev, SPEED232, LDISC_CLK)))
170
170
                return (0);
171
171
 
172
172
        /*
173
173
         * Allocate and initialize unit structure
174
174
         */
175
 
        if (!(up = (struct as2201unit *)
176
 
              emalloc(sizeof(struct as2201unit)))) {
177
 
                (void) close(fd);
178
 
                return (0);
179
 
        }
180
 
        memset((char *)up, 0, sizeof(struct as2201unit));
 
175
        up = emalloc(sizeof(*up));
 
176
        memset(up, 0, sizeof(*up));
181
177
        pp = peer->procptr;
182
178
        pp->io.clock_recv = as2201_receive;
183
179
        pp->io.srcclock = (caddr_t)peer;
184
180
        pp->io.datalen = 0;
185
181
        pp->io.fd = fd;
186
182
        if (!io_addclock(&pp->io)) {
187
 
                (void) close(fd);
 
183
                close(fd);
 
184
                pp->io.fd = -1;
188
185
                free(up);
189
186
                return (0);
190
187
        }
217
214
 
218
215
        pp = peer->procptr;
219
216
        up = (struct as2201unit *)pp->unitptr;
220
 
        io_closeclock(&pp->io);
221
 
        free(up);
 
217
        if (-1 != pp->io.fd)
 
218
                io_closeclock(&pp->io);
 
219
        if (NULL != up)
 
220
                free(up);
222
221
}
223
222
 
224
223