test-runner: Changed dbus starter to new functions

This commit is contained in:
Tim Kourt 2016-04-27 17:29:37 -07:00 committed by Denis Kenzior
parent a63a32acfd
commit 3fe7739e86
1 changed files with 6 additions and 26 deletions

View File

@ -404,41 +404,21 @@ static void create_dbus_system_conf(void)
static pid_t start_dbus_daemon(void)
{
char *argv[3], *envp[1];
char *argv[3];
pid_t pid;
int i;
argv[0] = "/usr/bin/dbus-daemon";
argv[1] = "--system";
argv[2] = NULL;
envp[0] = NULL;
printf("Starting D-Bus daemon\n");
pid = fork();
if (pid < 0) {
perror("Failed to fork new process");
pid = execute_program(argv, false);
if (pid < 0)
return -1;
}
if (pid == 0) {
execve(argv[0], argv, envp);
exit(EXIT_SUCCESS);
}
if (!wait_for_socket("/run/dbus/system_bus_socket", 25 * 10000))
return -1;
printf("D-Bus daemon process %d created\n", pid);
for (i = 0; i < 20; i++) {
struct stat st;
if (!stat("/run/dbus/system_bus_socket", &st)) {
printf("Found D-Bus daemon socket\n");
break;
}
usleep(25 * 1000);
}
l_info("D-Bus is running\n");
return pid;
}