From 19dfbe9e918da30e678816a393e61f3ad39ab9dc Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 21 Jul 2026 09:00:04 +0200 Subject: [PATCH] MT#61856 recording: clear recording path on failure If the dumper was not opened, then also take care to clear the recording path, because later the `response_pcap()` only checks the recording path itself and not wehther the dumper was actually opened. Hence NG would report a recording file, which indeed was never even created. For consistency reasons add the dumper's guard in the `response_pcap()`. Change-Id: Ifc1d5b73785633ffcc6293d64dbfbdea51b54582 --- daemon/recording.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/recording.c b/daemon/recording.c index eb27d769e..76b1e174b 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -701,9 +701,11 @@ static char *recording_open_pcap_file(struct recording *recording, char *path) { recording->pcap.recording_pd = pcap_open_dead(rec_pcap_format->linktype, 65535); recording->pcap.recording_pdumper = pcap_dump_open(recording->pcap.recording_pd, path); + if (recording->pcap.recording_pdumper == NULL) { pcap_close(recording->pcap.recording_pd); recording->pcap.recording_pd = NULL; + recording->pcap.recording_path = NULL; ilog(LOG_INFO, "Failed to write recording file: %s", path); } else { ilog(LOG_INFO, "Writing recording file: %s", path); @@ -833,6 +835,8 @@ static void response_pcap(struct recording *recording, const ng_parser_t *parser return; if (!recording->pcap.recording_path) return; + if (!recording->pcap.recording_pdumper) + return; parser_arg recordings = parser->dict_add_list(output, "recordings"); parser->list_add_string(recordings, recording->pcap.recording_path);