2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: replace duplicate warn_once() with common function

The warn_once() function is duplicated in 6 different places. A common,
reusable version has been added to parser_common.c.

Signed-off-by: Mike Salvatore <mike.salvatore@canonical.com>
This commit is contained in:
Mike Salvatore
2020-08-09 14:51:55 -04:00
parent 4aabc40d1f
commit 52d9529d1b
15 changed files with 57 additions and 87 deletions

View File

@@ -461,16 +461,7 @@ char *get_xattr_value(struct cond_entry *entry)
static void warn_once_xattr(const char *name)
{
static const char *warned_name = NULL;
if ((warnflags & WARN_RULE_DOWNGRADED) && warned_name != name) {
cerr << "Warning from profile " << name << " (";
if (current_filename)
cerr << current_filename;
else
cerr << "stdin";
cerr << ") xattr attachment conditional ignored\n";
warned_name = name;
}
common_warn_once(name, "xattr attachment conditional ignored", &warned_name);
}
static int process_profile_name_xmatch(Profile *prof)