diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-05-28 09:49:47 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-05-28 16:53:39 +0000 |
commit | c532bdc7ea70f6fe3d8c5296d0bf50b37c0c03fd (patch) | |
tree | 3f4c8beea3efc207848d6d9aaff5119c0119d55f /dumpcap.c | |
parent | 222de83d95993baf9f1d64138f8f040929b935d8 (diff) |
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 <gerald@wireshark.org>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -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); |