lsm/apparmor: use cleanup macro

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2021-08-09 15:59:26 +02:00
parent 0e8effda05
commit a36e286bea
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -611,8 +611,8 @@ out:
static bool file_is_yes(const char *path)
{
__do_close int fd = -EBADF;
ssize_t rd;
int fd;
char buf[8]; /* we actually just expect "yes" or "no" */
fd = open(path, O_RDONLY | O_CLOEXEC);
@ -620,7 +620,6 @@ static bool file_is_yes(const char *path)
return false;
rd = lxc_read_nointr(fd, buf, sizeof(buf));
close(fd);
return rd >= 4 && strnequal(buf, "yes\n", 4);
}