mirror of
git://github.com/lxc/lxc
synced 2025-09-03 19:09:33 +00:00
lsm/apparmor: use cleanup macro
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
@@ -611,8 +611,8 @@ out:
|
|||||||
|
|
||||||
static bool file_is_yes(const char *path)
|
static bool file_is_yes(const char *path)
|
||||||
{
|
{
|
||||||
|
__do_close int fd = -EBADF;
|
||||||
ssize_t rd;
|
ssize_t rd;
|
||||||
int fd;
|
|
||||||
char buf[8]; /* we actually just expect "yes" or "no" */
|
char buf[8]; /* we actually just expect "yes" or "no" */
|
||||||
|
|
||||||
fd = open(path, O_RDONLY | O_CLOEXEC);
|
fd = open(path, O_RDONLY | O_CLOEXEC);
|
||||||
@@ -620,7 +620,6 @@ static bool file_is_yes(const char *path)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
rd = lxc_read_nointr(fd, buf, sizeof(buf));
|
rd = lxc_read_nointr(fd, buf, sizeof(buf));
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return rd >= 4 && strnequal(buf, "yes\n", 4);
|
return rd >= 4 && strnequal(buf, "yes\n", 4);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user