test-runner: Fix -l/--emulator

This fixes -l/--emulator not able to start depending on what parameters
are given as it was not setting the directory properly.
This commit is contained in:
Luiz Augusto von Dentz 2022-03-08 18:00:49 -08:00
parent 8e1892cc92
commit 55888bfd62

View File

@ -609,13 +609,18 @@ static const char *btvirt_table[] = {
NULL
};
static pid_t start_btvirt(void)
static pid_t start_btvirt(const char *home)
{
const char *btvirt = NULL;
char *argv[3], *envp[2];
pid_t pid;
int i;
if (chdir(home + 5) < 0) {
perror("Failed to change home directory for daemon");
return -1;
}
for (i = 0; btvirt_table[i]; i++) {
struct stat st;
@ -690,7 +695,7 @@ static void run_command(char *cmdname, char *home)
monitor_pid = -1;
if (start_emulator)
emulator_pid = start_btvirt();
emulator_pid = start_btvirt(home);
else
emulator_pid = -1;