diff mbox series

[08/13] linux-user: Fix strace of chmod() if mode == 0

Message ID 20220826141853.419564-9-deller@gmx.de (mailing list archive)
State New, archived
Headers show
Series linux-user: Add more syscalls, enhance tracing & logging enhancements | expand

Commit Message

Helge Deller Aug. 26, 2022, 2:18 p.m. UTC
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>
---
 linux-user/strace.c | 5 +++++
 1 file changed, 5 insertions(+)

--
2.37.1
diff mbox series

Patch

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 86b2034c81..d1afa0e12a 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1504,6 +1504,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);