[PATCH BlueZ] test-runner: Fix issues found by coverity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux