From c532bdc7ea70f6fe3d8c5296d0bf50b37c0c03fd Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Thu, 28 May 2015 09:49:47 -0700 Subject: Set a capture buffer size only when we have a valid handle. Fixes the current Windows unit test crash. Clean up a warning message. Change-Id: I696e70c7656352d9576c1ad29703298cc7109621 Reviewed-on: https://code.wireshark.org/review/8674 Reviewed-by: Gerald Combs --- dumpcap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'dumpcap.c') diff --git a/dumpcap.c b/dumpcap.c index 5e2c69be92..68f23bc4f1 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -791,15 +791,13 @@ open_capture_device(capture_options *capture_opts /* Windows doesn't have pcap_create() yet */ #ifdef _WIN32 /* try to set the capture buffer size -- but not for remote devices */ - if (interface_opts->buffer_size > 1 && + if (pcap_h && interface_opts->buffer_size > 1 && pcap_setbuff(pcap_h, interface_opts->buffer_size * 1024 * 1024) != 0) { gchar *sync_secondary_msg_str; sync_secondary_msg_str = g_strdup_printf( - "The capture buffer size of %d MiB seems to be too high for your machine,\n" - "the default of %d MiB will be used.\n" - "\n" - "Nonetheless, the capture is started.\n", + "Unable to set a capture buffer size of %d MiB.\n" + "Capturing using the default size of %d MiB instead.", interface_opts->buffer_size, DEFAULT_CAPTURE_BUFFER_SIZE); report_capture_error("Couldn't set the capture buffer size.", sync_secondary_msg_str); -- cgit v1.2.1