@@ -40,6 +40,7 @@ struct QTestState
bool irq_level[MAX_IRQ];
GString *rx;
gchar *pid_file;
+ int child_pid;
char *socket_path, *qmp_socket_path;
};
@@ -144,6 +145,7 @@ QTestState *qtest_init(const char *extra_args)
s->rx = g_string_new("");
s->pid_file = pid_file;
+ s->child_pid = pid;
for (i = 0; i < MAX_IRQ; i++) {
s->irq_level[i] = false;
}
@@ -165,8 +167,9 @@ void qtest_quit(QTestState *s)
pid_t pid = qtest_qemu_pid(s);
if (pid != -1) {
- kill(pid, SIGTERM);
- waitpid(pid, &status, 0);
+ kill(pid, SIGTERM); /* kill QEMU */
+ waitpid(s->child_pid, &status, 0); /* but wait for the child created to
+ * run system() */
}
unlink(s->pid_file);