summaryrefslogtreecommitdiffstats
path: root/contrib/libpcap/fad-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libpcap/fad-win32.c')
-rw-r--r--contrib/libpcap/fad-win32.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/contrib/libpcap/fad-win32.c b/contrib/libpcap/fad-win32.c
index 8144fbb..4d2c01e 100644
--- a/contrib/libpcap/fad-win32.c
+++ b/contrib/libpcap/fad-win32.c
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2002 - 2003
- * NetGroup, Politecnico di Torino (Italy)
+ * Copyright (c) 2002 - 2005 NetGroup, Politecnico di Torino (Italy)
+ * Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -12,9 +12,10 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Politecnico di Torino nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * 3. Neither the name of the Politecnico di Torino, CACE Technologies
+ * nor the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -32,7 +33,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/fad-win32.c,v 1.11.2.1 2005/09/01 22:07:41 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/fad-win32.c,v 1.11.2.3 2006/02/22 17:09:32 gianluca Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -41,7 +42,7 @@ static const char rcsid[] _U_ =
#include <pcap.h>
#include <pcap-int.h>
-#include <packet32.h>
+#include <Packet32.h>
#include <errno.h>
@@ -224,22 +225,23 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf)
ULONG NameLength;
char *name;
- if(!PacketGetAdapterNames(NULL, &NameLength) && NameLength == 0)
+ if (!PacketGetAdapterNames(NULL, &NameLength))
{
- /*
- * If PacketGetAdapterNames *and* sets the lenght of the buffer to zero,
- * it means there was an error.
- */
- snprintf(errbuf, PCAP_ERRBUF_SIZE, "PacketGetAdapterNames failed: %s", pcap_win32strerror());
- *alldevsp = NULL;
- return -1;
+ DWORD last_error = GetLastError();
+
+ if (last_error != ERROR_INSUFFICIENT_BUFFER)
+ {
+ snprintf(errbuf, PCAP_ERRBUF_SIZE,
+ "PacketGetAdapterNames: %s",
+ pcap_win32strerror());
+ return (-1);
+ }
}
if (NameLength > 0)
AdaptersName = (char*) malloc(NameLength);
else
{
- snprintf(errbuf, PCAP_ERRBUF_SIZE, "no adapters found.");
*alldevsp = NULL;
return 0;
}
OpenPOWER on IntegriCloud