From 83fa97fd72f88138fdb107c7d96ab50ff865a04b Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgad.shaneh@audiocodes.com>
Date: Sun, 6 Apr 2025 17:49:55 +0300
Subject: [PATCH] MT#55283 Prevent warning logs when recording-method is pcap
 #2

If recording-method is pcap, then proc is zero-initialized, so
meta_filepath is empty. This shows many logs such as:

[core] Failed to open recording metadata file '(null)' for writing: Bad address

Prevent them by returning earlier.

Fixes #1889 for real this time.

Amends commit 759fd72dc6866b2c89eddd8940bb4b2040699f23.

Closes #1924

Change-Id: I25c9acefba9ee129354fd799ef493af86b9eab2c
(cherry picked from commit 312997c21df9d14c8fa1971ebd322d36339082bd)
---
 daemon/recording.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/daemon/recording.c b/daemon/recording.c
index 43f4c064f..30aec8682 100644
--- a/daemon/recording.c
+++ b/daemon/recording.c
@@ -835,6 +835,9 @@ static int vappend_meta_chunk(struct recording *recording, const char *buf, unsi
 		const char *label_fmt, va_list ap)
 {
 	struct iovec iov;
+	if (!recording->proc.meta_filepath)
+		return -1;
+
 	iov.iov_base = (void *) buf;
 	iov.iov_len = buflen;