[apparmor] [patch 2/2] fix: parser: close of fd with value of -1
john.johansen at canonical.com
john.johansen at canonical.com
Sat Oct 25 20:15:19 UTC 2014
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 at canonical.com>
---
parser/parser_interface.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- 3.0-diff.orig/parser/parser_interface.c
+++ 3.0-diff/parser/parser_interface.c
@@ -597,7 +597,8 @@
}
}
- close(fd);
+ if (fd != -1)
+ close(fd);
if (!prof->hat_table.empty() && option != OPTION_REMOVE) {
if (load_flattened_hats(prof, option) == 0)
More information about the AppArmor
mailing list