From 47dad25d57b85de9e2084a7d25e0b6e6daec1e3e Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 24 Nov 2008 18:06:39 +0000 Subject: From Roberto Mariani: get rid of some unused #defines. Close the descriptor before returning with PCAP_ERROR_RFMON_NOTSUP. --- pcap-usb-linux.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'pcap-usb-linux.c') diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 3858e84..c79211e 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -34,7 +34,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.25 2008-11-24 17:40:19 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-usb-linux.c,v 1.26 2008-11-24 18:06:39 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -66,13 +66,6 @@ static const char rcsid[] _U_ = #define USB_BUS_DIR "/proc/bus/usb" #define USB_LINE_LEN 4096 - -#define PIPE_IN 0x80 -#define PIPE_ISOCHRONOUS 0 -#define PIPE_INTERRUPT 1 -#define PIPE_CONTROL 2 -#define PIPE_BULK 3 - #if __BYTE_ORDER == __LITTLE_ENDIAN #define htols(s) s #define htoll(l) l @@ -230,6 +223,7 @@ usb_activate(pcap_t* handle) /* * Monitor mode doesn't apply to USB devices. */ + close(handle->fd); return PCAP_ERROR_RFMON_NOTSUP; } @@ -262,17 +256,19 @@ usb_activate(pcap_t* handle) "Can't open USB bus file %s: %s", full_path, strerror(errno)); return PCAP_ERROR; } + + if (handle->opt.rfmon) { + /* + * Monitor mode doesn't apply to USB devices. + */ + close(handle->fd); + return PCAP_ERROR_RFMON_NOTSUP; + } + handle->stats_op = usb_stats_linux; handle->read_op = usb_read_linux; } - if (handle->opt.rfmon) { - /* - * Monitor mode doesn't apply to USB devices. - */ - return PCAP_ERROR_RFMON_NOTSUP; - } - /* * "handle->fd" is a real file, so "select()" and "poll()" * work on it. -- cgit v1.2.3