From 40380a8042dfc2efa6f8f06ed7ac86c3c20a343f Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 9 Aug 2022 13:49:42 +1000 Subject: [PATCH] ctdb-common: Stop a pcap-related crash on error errbuf can't be NULL. Might as well use it. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/common/system_socket.c | 7 +++++-- 1 file 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; -- 2.11.4.GIT