linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] test-runner: Fix issues found by coverity
@ 2022-06-17 19:49 Frédéric Danis
  2022-06-17 21:24 ` [BlueZ] " bluez.test.bot
  2022-06-17 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Frédéric Danis @ 2022-06-17 19:49 UTC (permalink / raw)
  To: linux-bluetooth

---
 tools/test-runner.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/test-runner.c b/tools/test-runner.c
index 49fc21325..6886d66c6 100644
--- a/tools/test-runner.c
+++ b/tools/test-runner.c
@@ -275,6 +275,10 @@ static void start_qemu(void)
 		char *xdg_runtime_dir, *audiodev;
 
 		xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
+		if (!xdg_runtime_dir) {
+			fprintf(stderr, "XDG_RUNTIME_DIR not set\n");
+			exit(1);
+		}
 		audiodev = alloca(40 + strlen(xdg_runtime_dir));
 		sprintf(audiodev, "id=audio,driver=pa,server=%s/pulse/native",
 				xdg_runtime_dir);
@@ -474,8 +478,14 @@ static void create_dbus_session_conf(void)
 				"/usr/share/dbus-1/session.conf") < 0)
 		perror("Failed to create session.conf symlink");
 
-	mkdir("/run/user", 0755);
-	mkdir("/run/user/0", 0755);
+	if (mkdir("/run/user", 0755) < 0) {
+		fprintf(stderr, "unable to create /run/user directory\n");
+		return;
+	}
+	if (mkdir("/run/user/0", 0755) < 0) {
+		fprintf(stderr, "unable to create /run/user/0 directory\n");
+		return;
+	}
 }
 
 static pid_t start_dbus_daemon(bool session)
@@ -919,7 +929,7 @@ start_next:
 
 		if (corpse == dbus_session_pid) {
 			printf("D-Bus session daemon terminated\n");
-			dbus_pid = -1;
+			dbus_session_pid = -1;
 		}
 
 		if (corpse == daemon_pid) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-17 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17 19:49 [PATCH BlueZ] test-runner: Fix issues found by coverity Frédéric Danis
2022-06-17 21:24 ` [BlueZ] " bluez.test.bot
2022-06-17 23:20 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).