1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ctdb-common: Stop a pcap-related crash on error

errbuf can't be NULL.  Might as well use it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-08-09 13:49:42 +10:00 committed by Amitay Isaacs
parent 8b54587b1a
commit 40380a8042

View File

@ -969,11 +969,14 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data,
int ctdb_sys_open_capture_socket(const char *iface, void **private_data) int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
{ {
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *pt; pcap_t *pt;
pt=pcap_open_live(iface, 100, 0, 0, NULL); pt = pcap_open_live(iface, 100, 0, 0, errbuf);
if (pt == NULL) { if (pt == NULL) {
DBG_ERR("Failed to open capture device %s\n", iface); DBG_ERR("Failed to open pcap capture device %s (%s)\n",
iface,
errbuf);
return -1; return -1;
} }
*((pcap_t **)private_data) = pt; *((pcap_t **)private_data) = pt;