Merge pull request #318 from mrunalp/subreaper
Use the child subreaper option only when available
This commit is contained in:
commit
be02944484
|
@ -15,10 +15,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#ifndef PR_SET_CHILD_SUBREAPER
|
|
||||||
#define PR_SET_CHILD_SUBREAPER 36
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const kBufSize = 256;
|
static const kBufSize = 256;
|
||||||
static const char *kNsEnter = "nsenter";
|
static const char *kNsEnter = "nsenter";
|
||||||
|
|
||||||
|
@ -93,11 +89,13 @@ void nsenter()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PR_SET_CHILD_SUBREAPER
|
||||||
if (prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == -1) {
|
if (prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == -1) {
|
||||||
fprintf(stderr, "nsenter: failed to set child subreaper: %s",
|
fprintf(stderr, "nsenter: failed to set child subreaper: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static const struct option longopts[] = {
|
static const struct option longopts[] = {
|
||||||
{"nspid", required_argument, NULL, 'n'},
|
{"nspid", required_argument, NULL, 'n'},
|
||||||
|
|
Loading…
Reference in New Issue