diff mbox series

[PULL,09/37] linux-user: Fix strace of chmod() if mode == 0

Message ID 20220928202737.793171-10-laurent@vivier.eu (mailing list archive)
State New, archived
Headers show
Series [PULL,01/37] linux-user: use 'max' instead of 'qemu32' / 'qemu64' by default | expand

Commit Message

Laurent Vivier Sept. 28, 2022, 8:27 p.m. UTC
From: Helge Deller <deller@gmx.de>

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 <deller@gmx.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220918194555.83535-8-deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/strace.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 5ac64df02b85..2f539845bb90 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);