From: Gregor Jasny Date: Mon, 21 Sep 2020 18:41:30 +0000 (+0200) Subject: Handle waitpid interruption and add missing string header (#669) X-Git-Tag: v4.0~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51d40e88c7593d701ba61090608aecdc9e751a9d;p=thirdparty%2Fccache.git Handle waitpid interruption and add missing string header (#669) --- diff --git a/src/TemporaryFile.hpp b/src/TemporaryFile.hpp index 3aae4f90e..493445bb4 100644 --- a/src/TemporaryFile.hpp +++ b/src/TemporaryFile.hpp @@ -22,6 +22,8 @@ #include "third_party/nonstd/string_view.hpp" +#include + // This class represents a unique temporary file created by mkstemp. The file is // not deleted by the destructor. class TemporaryFile diff --git a/src/execute.cpp b/src/execute.cpp index c650c8525..0d628b7fb 100644 --- a/src/execute.cpp +++ b/src/execute.cpp @@ -182,7 +182,12 @@ execute(const char* const* argv, Fd&& fd_out, Fd&& fd_err, pid_t* pid) fd_err.close(); int status; - if (waitpid(*pid, &status, 0) != *pid) { + int result; + + while ((result = waitpid(*pid, &status, 0)) != *pid) { + if (result == -1 && errno == EINTR) { + continue; + } throw Fatal("waitpid failed: {}", strerror(errno)); }