]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
seccomp: minor simplifications for is_seccomp_available() 4991/head
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Dec 2016 15:50:02 +0000 (16:50 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 18 Jan 2017 03:14:27 +0000 (22:14 -0500)
src/shared/seccomp-util.c

index 497426f605b8c9e4d1f794301a53d83f438895e3..2c73cb8fa43df70922c6f95a2aa717d00d9ed0bb 100644 (file)
@@ -204,21 +204,22 @@ finish:
 }
 
 static bool is_basic_seccomp_available(void) {
-        int r;
-        r = prctl(PR_GET_SECCOMP, 0, 0, 0, 0);
-        return r >= 0;
+        return prctl(PR_GET_SECCOMP, 0, 0, 0, 0) >= 0;
 }
 
 static bool is_seccomp_filter_available(void) {
-        int r;
-        r = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
-        return r < 0 && errno == EFAULT;
+        return prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0) < 0 &&
+                errno == EFAULT;
 }
 
 bool is_seccomp_available(void) {
         static int cached_enabled = -1;
+
         if (cached_enabled < 0)
-                cached_enabled = is_basic_seccomp_available() && is_seccomp_filter_available();
+                cached_enabled =
+                        is_basic_seccomp_available() &&
+                        is_seccomp_filter_available();
+
         return cached_enabled;
 }