]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-bpf.c
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / test / test-bpf.c
index 6ca2be41b058131899fc5eb65d5cf7b495d7e49d..1a5a09a331bfd35069144b84dda08b49a2608d6e 100644 (file)
@@ -1,21 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 /***
-  This file is part of systemd.
-
-  Copyright 2016 Daniel Mack
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+  Copyright © 2016 Daniel Mack
 ***/
 
 #include <linux/libbpf.h>
@@ -41,7 +26,7 @@ int main(int argc, char *argv[]) {
         _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL;
         CGroupContext *cc = NULL;
         _cleanup_(bpf_program_unrefp) BPFProgram *p = NULL;
-        Manager *m = NULL;
+        _cleanup_(manager_freep) Manager *m = NULL;
         Unit *u;
         char log_buf[65535];
         int r;
@@ -128,11 +113,9 @@ int main(int argc, char *argv[]) {
         unit_dump(u, stdout, NULL);
 
         r = bpf_firewall_compile(u);
-        if (IN_SET(r, -ENOTTY, -ENOSYS, -EPERM )) {
+        if (IN_SET(r, -ENOTTY, -ENOSYS, -EPERM ))
                 /* Kernel doesn't support the necessary bpf bits, or masked out via seccomp? */
-                manager_free(m);
                 return EXIT_TEST_SKIP;
-        }
         assert_se(r >= 0);
 
         assert(u->ip_bpf_ingress);
@@ -167,7 +150,5 @@ int main(int argc, char *argv[]) {
         assert_se(SERVICE(u)->exec_command[SERVICE_EXEC_START]->command_next->exec_status.code != CLD_EXITED ||
                   SERVICE(u)->exec_command[SERVICE_EXEC_START]->command_next->exec_status.status != EXIT_SUCCESS);
 
-        manager_free(m);
-
         return 0;
 }