[PATCH v2 1/7] graph: fix double close of pcapng file
Stephen Hemminger
stephen at networkplumber.org
Wed Dec 2 18:49:39 CET 2026
If adding an interface to the capture file failed, the error path
called rte_pcapng_close(), which closes the file descriptor,
and then closed the same descriptor again.
Only close the descriptor directly if rte_pcapng_fdopen() failed.
Fixes: df5908c98abc ("graph: fix pcapng file support")
Cc: stable at dpdk.org
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/graph/graph_pcap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/graph/graph_pcap.c b/lib/graph/graph_pcap.c
index 78859ec2d4..07678d967d 100644
--- a/lib/graph/graph_pcap.c
+++ b/lib/graph/graph_pcap.c
@@ -128,11 +128,13 @@ graph_pcap_file_open(const char *filename)
done:
return 0;
error:
+ /* once rte_pcapng_fdopen() succeeds, the fd is closed by rte_pcapng_close() */
if (pcapng_fd != NULL) {
rte_pcapng_close(pcapng_fd);
pcapng_fd = NULL;
+ } else {
+ close(fd);
}
- close(fd);
return -1;
}
--
2.53.0
More information about the stable
mailing list