mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-01 05:54:08 +01:00
test-runner: Changed dbus starter to new functions
This commit is contained in:
parent
a63a32acfd
commit
3fe7739e86
@ -404,41 +404,21 @@ static void create_dbus_system_conf(void)
|
|||||||
|
|
||||||
static pid_t start_dbus_daemon(void)
|
static pid_t start_dbus_daemon(void)
|
||||||
{
|
{
|
||||||
char *argv[3], *envp[1];
|
char *argv[3];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int i;
|
|
||||||
|
|
||||||
argv[0] = "/usr/bin/dbus-daemon";
|
argv[0] = "/usr/bin/dbus-daemon";
|
||||||
argv[1] = "--system";
|
argv[1] = "--system";
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
|
|
||||||
envp[0] = NULL;
|
pid = execute_program(argv, false);
|
||||||
|
if (pid < 0)
|
||||||
printf("Starting D-Bus daemon\n");
|
|
||||||
|
|
||||||
pid = fork();
|
|
||||||
if (pid < 0) {
|
|
||||||
perror("Failed to fork new process");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (pid == 0) {
|
if (!wait_for_socket("/run/dbus/system_bus_socket", 25 * 10000))
|
||||||
execve(argv[0], argv, envp);
|
return -1;
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("D-Bus daemon process %d created\n", pid);
|
l_info("D-Bus is running\n");
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user