From: Helge Deller Date: Sun, 18 Sep 2022 19:45:50 +0000 (+0200) Subject: linux-user: Fix strace of chmod() if mode == 0 X-Git-Tag: v7.2.0-rc0~69^2~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=105d599a33462bd64529bc3bacc68e2d0fbb876b;p=thirdparty%2Fqemu.git linux-user: Fix strace of chmod() if mode == 0 If the mode parameter of chmod() is zero, this value isn't shown when stracing a program: chmod("filename",) This patch fixes it up to show the zero-value as well: chmod("filename",000) Signed-off-by: Helge Deller Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20220918194555.83535-8-deller@gmx.de> Signed-off-by: Laurent Vivier --- diff --git a/linux-user/strace.c b/linux-user/strace.c index 5ac64df02b8..2f539845bb9 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -1505,6 +1505,11 @@ print_file_mode(abi_long mode, int last) const char *sep = ""; const struct flags *m; + if (mode == 0) { + qemu_log("000%s", get_comma(last)); + return; + } + for (m = &mode_flags[0]; m->f_string != NULL; m++) { if ((m->f_value & mode) == m->f_value) { qemu_log("%s%s", m->f_string, sep);