]> The Tcpdump Group git mirrors - libpcap/blobdiff - pcap-dlpi.c
Turn close_op into cleanup_op; the routine that handles it can also be
[libpcap] / pcap-dlpi.c
index 0cf5bccbe90e375bd4b93a822f54ee9ed6c4df47..695e48ad34510afeb23a2194e1728d41335cad15 100644 (file)
@@ -70,7 +70,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.116.2.10 2008-04-10 00:50:54 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/pcap-dlpi.c,v 1.116.2.11 2008-04-14 20:41:51 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -314,11 +314,13 @@ pcap_inject_dlpi(pcap_t *p, const void *buf, size_t size)
 #endif /* HAVE_SOLARIS */
 
 static void
-pcap_close_dlpi(pcap_t *p)
+pcap_cleanup_dlpi(pcap_t *p)
 {
-       pcap_close_common(p);
-       if (p->send_fd >= 0)
+       if (p->send_fd >= 0) {
                close(p->send_fd);
+               p->send_fd = -1;
+       }
+       pcap_cleanup_live_common(p);
 }
 
 static int
@@ -344,9 +346,6 @@ pcap_activate_dlpi(pcap_t *p)
 #endif
        int status = PCAP_ERROR;
 
-       p->fd = -1;     /* indicate that it hasn't been opened yet */
-       p->send_fd = -1;
-
 #ifdef HAVE_DEV_DLPI
        /*
        ** Remove any "/dev/" on the front of the device.
@@ -750,14 +749,11 @@ pcap_activate_dlpi(pcap_t *p)
        p->getnonblock_op = pcap_getnonblock_fd;
        p->setnonblock_op = pcap_setnonblock_fd;
        p->stats_op = pcap_stats_dlpi;
-       p->close_op = pcap_close_dlpi;
+       p->cleanup_op = pcap_cleanup_dlpi;
 
        return (status);
 bad:
-       if (p->fd >= 0)
-               close(p->fd);
-       if (p->send_fd >= 0)
-               close(p->send_fd);
+       pcap_cleanup_dlpi(p);
        return (status);
 }
 
@@ -1686,6 +1682,8 @@ pcap_create(const char *device, char *ebuf)
        if (p == NULL)
                return (NULL);
 
+       p->send_fd = -1;        /* it hasn't been opened yet */
+
        p->activate_op = pcap_activate_dlpi;
        return (p);
 }