Skip to content

Commit

Permalink
fixup! Gracefully handle the lack of subreaper support in Linux.
Browse files Browse the repository at this point in the history
This is a tiny amendment to @philwo's patch for #11637 which fixes up `prctl` error handling.

Resolves #11637

Closes #11698.

PiperOrigin-RevId: 319425717
  • Loading branch information
rbeasley authored and meisterT committed Jul 6, 2020
1 parent 7404d17 commit a4334be
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/tools/process-wrapper-options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ static void ParseCommandLine(const std::vector<char *> &args) {
case 'W':
#if defined(__linux__)
unsigned long result; // NOLINT(runtime/int) - interface requires long
if (prctl(PR_GET_CHILD_SUBREAPER, &result, 0, 0, 0) == EINVAL) {
if (prctl(PR_GET_CHILD_SUBREAPER, &result, 0, 0, 0) == -1 &&
errno == EINVAL) {
fprintf(stderr,
"warning: The \"wait for subprocesses\" feature requires "
"Linux kernel version 3.4 or later.\n");
Expand Down

0 comments on commit a4334be

Please sign in to comment.