aboutsummaryrefslogtreecommitdiffstats
path: root/capture-wpcap.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-01-21 23:45:36 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2007-01-21 23:45:36 +0000
commita77c32bbd28a4bf9ff3e49c7766d1327b86d41db (patch)
tree5512510787af52895ceb934713d75bf182fa3033 /capture-wpcap.c
parentc02e067a72dd0f37f65a7da9fc8a632e8ed71bfa (diff)
Have the routines to get interface lists take a pointer to a "gchar *"
as an argument, and, on an error, if they have an error message, have them set that "gchar *" to point to a g_malloc()ed string containing the error message, rather than taking a pointer to a buffer for that message as an argument. That's more like what's done in Wiretap, and doesn't impose an upper limit on the lengths of those error messages. If that pointer is null, don't allocate the message string and return it. Have that error message already have the "cant_get" processing applied to it, so nobody other than those routines need to call the "cant_get" routines to process the error messages. Have get_airpcap_interface_list() explicitly set "*err" to the appropriate error code. Clean up indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20521 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture-wpcap.c')
-rw-r--r--capture-wpcap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/capture-wpcap.c b/capture-wpcap.c
index dcbb1adef6..7b1ecb3429 100644
--- a/capture-wpcap.c
+++ b/capture-wpcap.c
@@ -465,7 +465,7 @@ int pcap_next_ex (pcap_t *a, struct pcap_pkthdr **b, const u_char **c)
* fall back on "pcap_lookupdev()".
*/
GList *
-get_interface_list(int *err, char *err_str)
+get_interface_list(int *err, char **err_str)
{
GList *il = NULL;
wchar_t *names;
@@ -473,6 +473,7 @@ get_interface_list(int *err, char *err_str)
char ascii_name[MAX_WIN_IF_NAME_LEN + 1];
char ascii_desc[MAX_WIN_IF_NAME_LEN + 1];
int i, j;
+ char errbuf[PCAP_ERRBUF_SIZE];
#ifdef HAVE_PCAP_FINDALLDEVS
if (p_pcap_findalldevs != NULL)
@@ -522,7 +523,7 @@ get_interface_list(int *err, char *err_str)
* description of the Nth adapter.
*/
- names = (wchar_t *)pcap_lookupdev(err_str);
+ names = (wchar_t *)pcap_lookupdev(errbuf);
i = 0;
if (names) {
@@ -609,6 +610,8 @@ get_interface_list(int *err, char *err_str)
* No interfaces found.
*/
*err = NO_INTERFACES_FOUND;
+ if (err_str != NULL)
+ *err_str = NULL;
}
return il;