Skip to content

Commit

Permalink
linux-user: Fix strace of chmod() if mode == 0
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
hdeller authored and vivier committed Sep 27, 2022
1 parent 770525f commit 105d599
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions linux-user/strace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 105d599

Please sign in to comment.