mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 13:58:22 +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:
@@ -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 (!prof->hat_table.empty() && option != OPTION_REMOVE) {
|
||||||
if (load_flattened_hats(prof, option) == 0)
|
if (load_flattened_hats(prof, option) == 0)
|
||||||
|
Reference in New Issue
Block a user