mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 05:47:59 +00:00
fix: parser: close of fd with value of -1
Both valgrind and strace report the parser doing close(-1) = -1 EBADF (Bad file descriptor) This happens the skip kernel load argument is specified in combination with any of --add, --replace, or --remove arguments (the default is --add if no other option is specified). This happens when the parser is not processing profiles but not writing them out (eg. no kernel load, dump to stdout, file ...) Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
parent
542f6301e9
commit
c11ad5a800
@ -597,7 +597,8 @@ int __sd_serialize_profile(int option, Profile *prof)
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
if (fd != -1)
|
||||
close(fd);
|
||||
|
||||
if (!prof->hat_table.empty() && option != OPTION_REMOVE) {
|
||||
if (load_flattened_hats(prof, option) == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user