From 03857c43ce099e50fbb78dd4b32eb75759b83ae0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 23 Jun 2016 01:31:24 +0200 Subject: [PATCH] execute: use the return value of setrlimit_closest() properly It's a function defined by us, hence we should look for the error in its return value, not in "errno". --- src/core/execute.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/execute.c b/src/core/execute.c index 3c3369373f5..ac87e334a46 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1951,12 +1951,14 @@ static int exec_child( int secure_bits = context->secure_bits; for (i = 0; i < _RLIMIT_MAX; i++) { + if (!context->rlimit[i]) continue; - if (setrlimit_closest(i, context->rlimit[i]) < 0) { + r = setrlimit_closest(i, context->rlimit[i]); + if (r < 0) { *exit_status = EXIT_LIMITS; - return -errno; + return r; } }