From a1ac9b101571477a81e1cb3c6999f818bbbf0738 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Tue, 6 Jan 2015 18:30:30 -0500 Subject: [PATCH] Use the child subreaper option only when available Signed-off-by: Mrunal Patel (github: mrunalp) --- namespaces/nsenter/nsenter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/namespaces/nsenter/nsenter.c b/namespaces/nsenter/nsenter.c index 1a81c315..b735b1fa 100644 --- a/namespaces/nsenter/nsenter.c +++ b/namespaces/nsenter/nsenter.c @@ -15,10 +15,6 @@ #include #include -#ifndef PR_SET_CHILD_SUBREAPER -#define PR_SET_CHILD_SUBREAPER 36 -#endif - static const kBufSize = 256; static const char *kNsEnter = "nsenter"; @@ -93,11 +89,13 @@ void nsenter() return; } + #ifdef PR_SET_CHILD_SUBREAPER if (prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == -1) { fprintf(stderr, "nsenter: failed to set child subreaper: %s", strerror(errno)); exit(1); } + #endif static const struct option longopts[] = { {"nspid", required_argument, NULL, 'n'},