conmon: do not fail if waitpid is interrupted

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2017-07-23 18:54:03 +02:00
parent 1aa0d5da86
commit 55310f9a95

View file

@ -1228,8 +1228,12 @@ int main(int argc, char *argv[])
g_main_loop_run (main_loop);
g_source_remove (terminal_watch);
} else {
int ret;
/* Wait for our create child to exit with the return code. */
if (waitpid(create_pid, &runtime_status, 0) < 0) {
do
ret = waitpid(create_pid, &runtime_status, 0);
while (ret < 0 && errno == EINTR);
if (ret < 0) {
int old_errno = errno;
kill(create_pid, SIGKILL);
errno = old_errno;