The read() call in bios_supports_mode() can fail with EINTR if a child terminates during the call. Handle it.
Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com> --- qga/commands-posix.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 41ba0c5..4d8c067 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -621,10 +621,14 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg, goto out; } - ret = read(pipefds[0], &status, sizeof(status)); - if (ret == sizeof(status) && WIFEXITED(status) && - WEXITSTATUS(status) == SUSPEND_SUPPORTED) { - goto out; + while (true) { + ret = read(pipefds[0], &status, sizeof(status)); + if (ret == sizeof(status) && WIFEXITED(status) && + WEXITSTATUS(status) == SUSPEND_SUPPORTED) { + goto out; + } else if (ret == -1 && errno != EINTR) { + break; + } } error_set(err, QERR_UNSUPPORTED); -- 1.7.9.2.384.g4a92a