From d96d69a60ca1afe70bd2bf196fed2f2da9acf432 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Tue, 17 Dec 2024 11:47:48 -0800 Subject: [PATCH] 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 (cherry picked from commit 96718ea4d15b0a4551fece1c36b8360c2e44fad3) Signed-off-by: John Johansen --- parser/mount.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parser/mount.cc b/parser/mount.cc index 9b4e84ae2..0bd4ecf3f 100644 --- a/parser/mount.cc +++ b/parser/mount.cc @@ -313,10 +313,16 @@ static struct mnt_keyword_table mnt_conds_table[] = { static ostream &dump_flags(ostream &os, pair flags) { + bool is_first = true; for (int i = 0; mnt_opts_table[i].keyword; i++) { 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; + } } return os; }