2023-07-12 21:51:38

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ v2 2/2] test-runner: fix behavior when no audio server

If no audio server, don't pass NULL to printf and parse TESTAUDIO
correctly.
---
tools/test-runner.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 119e1cfbc..243eab468 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -277,7 +277,8 @@ static void start_qemu(void)
initcmd, cwd, start_dbus, start_daemon,
start_dbus_session,
start_monitor, start_emulator, num_devs,
- run_auto, audio_server, testargs);
+ run_auto, audio_server ? audio_server : "",
+ testargs);

argv = alloca(sizeof(qemu_argv) +
(sizeof(char *) * (4 + (num_devs * 4))));
@@ -1132,7 +1133,7 @@ static void run_tests(void)
const char *start = ptr + 11;
const char *end = strchr(start, '\'');

- if (end) {
+ if (end && end != start) {
audio_server = strndup(start, end - start);
printf("Audio server %s requested\n", audio_server);
}
--
2.41.0