]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: use the return value of setrlimit_closest() properly
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Jun 2016 23:31:24 +0000 (01:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Jun 2016 23:31:24 +0000 (01:31 +0200)
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

index 3c3369373f54930f2ba97c7758e4532c6e577194..ac87e334a462622a54a7bee7d0577c1c482378fb 100644 (file)
@@ -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;
                         }
                 }