summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2022-08-09 13:49:42 +1000
committerAmitay Isaacs <amitay@samba.org>2022-09-20 10:43:37 +0000
commit40380a8042dfc2efa6f8f06ed7ac86c3c20a343f (patch)
tree2f0c3fba7ee79998dd6987861d3c4ef168ceb8ce /ctdb
parent8b54587b1aed28aa2f3af7161a077aa9dd83894c (diff)
downloadsamba-40380a8042dfc2efa6f8f06ed7ac86c3c20a343f.tar.gz
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>
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/common/system_socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c
index 71c60853ee3..43910e9b177 100644
--- a/ctdb/common/system_socket.c
+++ b/ctdb/common/system_socket.c
@@ -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)
{
+ char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *pt;
- pt=pcap_open_live(iface, 100, 0, 0, NULL);
+ pt = pcap_open_live(iface, 100, 0, 0, errbuf);
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;
}
*((pcap_t **)private_data) = pt;