chiark / gitweb /
util: replace close_nointr_nofail() by a more useful safe_close()
[elogind.git] / src / core / ima-setup.c
index e8cc1ba8b6cb451775e06d189dd46c9a91d99193..ed65096f043a9379ac8b58a46f5bd19693777cf7 100644 (file)
@@ -47,14 +47,9 @@ int ima_setup(void) {
        struct stat st;
        ssize_t policy_size = 0, written = 0;
        char *policy;
-       int policyfd = -1, imafd = -1;
+       _cleanup_close_ int policyfd = -1, imafd = -1;
        int result = 0;
 
-#ifndef HAVE_SELINUX
-       /* Mount the securityfs filesystem */
-       mount_setup_early();
-#endif
-
        if (stat(IMA_POLICY_PATH, &st) < 0)
                return 0;
 
@@ -103,10 +98,6 @@ int ima_setup(void) {
 out_mmap:
        munmap(policy, policy_size);
 out:
-       if (policyfd >= 0)
-                close_nointr_nofail(policyfd);
-       if (imafd >= 0)
-                close_nointr_nofail(imafd);
        if (result)
                 return result;
 #endif /* HAVE_IMA */