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

Merge Add separator between mount flags in dump_flags

The previous code would concatenate all of them together without spacing.
While dump_flags and the corresponding operator<< function aren't currently used,
this will help for when dump_flags is used to debug parser problems.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1465
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>

(cherry picked from commit 67ee5f8b39)
This commit is contained in:
John Johansen
2025-01-09 01:40:41 -08:00

View File

@@ -313,10 +313,16 @@ static struct mnt_keyword_table mnt_conds_table[] = {
static ostream &dump_flags(ostream &os, static ostream &dump_flags(ostream &os,
pair <unsigned int, unsigned int> flags) pair <unsigned int, unsigned int> flags)
{ {
bool is_first = true;
for (int i = 0; mnt_opts_table[i].keyword; i++) { for (int i = 0; mnt_opts_table[i].keyword; i++) {
if ((flags.first & mnt_opts_table[i].set) || if ((flags.first & mnt_opts_table[i].set) ||
(flags.second & mnt_opts_table[i].clear)) (flags.second & mnt_opts_table[i].clear)) {
if (!is_first) {
os << ", ";
}
is_first = false;
os << mnt_opts_table[i].keyword; os << mnt_opts_table[i].keyword;
}
} }
return os; return os;
} }