summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-26 17:42:36 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-26 17:42:36 -0400
commit52d972610953cc448d505e72a0635cc15fd50918 (patch)
tree1657961f2ed811b6900623cb1e064b4a775a12a1 /lib
parent7020f85079b8ea7b4ccf1b9074f536fa55554de7 (diff)
qemu-wrapper: Don't use SA_RESTART
SA_RESTART + SIGALRM is janky Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/qemu-wrapper.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/qemu-wrapper.c b/lib/qemu-wrapper.c
index 7025716..4c3b6f1 100644
--- a/lib/qemu-wrapper.c
+++ b/lib/qemu-wrapper.c
@@ -227,16 +227,13 @@ int main(int argc, char *argv[])
ssize_t len;
char *line = NULL;
- struct sigaction alarm_action = {
- .sa_handler = alarm_handler,
- .sa_flags = SA_RESTART,
- };
+ struct sigaction alarm_action = { .sa_handler = alarm_handler };
if (sigaction(SIGALRM, &alarm_action, NULL))
die("sigaction error: %m");
if (timeout)
alarm(timeout);
-
+again:
while ((len = getline(&line, &n, childf)) >= 0) {
strim(line);
@@ -280,7 +277,11 @@ int main(int argc, char *argv[])
free(output);
}
- fputs("done", stdout);
+ if (len == -1 && errno == EINTR) {
+ clearerr(childf);
+ goto again;
+ }
+
kill(child, SIGKILL);
exit(ret);
}