X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=httpinput.cpp;h=1b09abf6ce8ad550b6c371853fdbcd0bc0bb8e6f;hp=274cc2687b160d45e365fc7f4daafb665b9d2660;hb=941a7e35cd1b51dcd15159e23cc4a1e82ae4808b;hpb=e3f2936e3c9ff3b5569759c1aaed16f03bf728f8 diff --git a/httpinput.cpp b/httpinput.cpp index 274cc26..1b09abf 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -383,8 +383,20 @@ void HTTPInput::do_work() switch (state) { case NOT_CONNECTED: { // Reap any exited children. - int wstatus; - while (waitpid(-1, &wstatus, WNOHANG) != -1 || errno == EINTR) ; + int wstatus, err; + do { + err = waitpid(-1, &wstatus, WNOHANG); + if (err == -1) { + if (errno == EINTR) { + continue; + } + if (errno == ECHILD) { + break; + } + log_perror("waitpid"); + break; + } + } while (err != 0); request.clear(); request_bytes_sent = 0;