libsmack: fix: fail if neither 'load' and 'load2' cannot be opened
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 13 Jan 2014 07:45:42 +0000 (09:45 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 13 Jan 2014 07:49:56 +0000 (09:49 +0200)
accesses_apply() continued even if neither 'load' and 'load2' could
not be opened. For 'change-rule' file such semantics do make sense
for backwards compatibility but there's something seriously wrong
if neither 'load' and 'load2' cannot be opened. That's why the only
right thing to do is to stop immediately.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack/libsmack.c

index 9f3798c..8e88d47 100644 (file)
@@ -616,8 +616,7 @@ static int accesses_apply(struct smack_accesses *handle, int clear)
                        return -1;
                /* fallback */
                load_fd = openat(smackfs_mnt_dirfd, "load", O_WRONLY);
-               /* Try to continue if the file doesn't exist, we might not need it. */
-               if (load_fd < 0 && errno != ENOENT)
+               if (load_fd < 0)
                        return -1;
                load2 = 0;
        }