From af83f1be64fcb4d9dc7905e1c077d59e3429ff08 Mon Sep 17 00:00:00 2001 From: "Balazs Gerofi bgerofi@riken.jp" Date: Thu, 4 Dec 2014 17:40:00 +0900 Subject: [PATCH] rlimit(RLIMIT_NOFILE): return one less to make sure sync pipe can be created (LTP fork09) --- kernel/syscall.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/syscall.c b/kernel/syscall.c index 228e18a7..b8b969a1 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -2330,6 +2330,12 @@ SYSCALL_DECLARE(getrlimit) case RLIMIT_NOFILE: /* just forward */ ret = syscall_generic_forwarding(n, ctx); + + /* return one less than the actual value to make sure mcexec can open + * its temporary synchronization pipe when a new process is forked */ + if (resource == RLIMIT_NOFILE) { + ret -= 1; + } break; default: