fixup! Gracefully handle the lack of subreaper support in Linux.
This is a tiny amendment to @philwo's patch for #11637 which fixes up `prctl` error handling.
Resolves #11637
Closes #11698.
PiperOrigin-RevId: 319425717
diff --git a/src/main/tools/process-wrapper-options.cc b/src/main/tools/process-wrapper-options.cc
index 8f6a782..ab6382c 100644
--- a/src/main/tools/process-wrapper-options.cc
+++ b/src/main/tools/process-wrapper-options.cc
@@ -127,7 +127,8 @@
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");