aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Bozuta <Filip.Bozuta@syrmia.com>2020-07-02 18:09:15 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-08-23 16:57:58 +0200
commit664441ea0111ef4dc68510d87b89b983ef838500 (patch)
treeb2c183e1cd57f3941e5dd13230ed15e3d92b6fa1
parentd7df0ceee0fd2e512cd214a9074ebeeb40da3099 (diff)
downloadqemu-arm-664441ea0111ef4dc68510d87b89b983ef838500.tar.gz
linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last value
Function "print_fdset()" in "strace.c" is used to print the file descriptor values in "print__newselect()" which prints arguments of syscall _newselect(). Until changes from this patch, this function was printing "," even after the last value of the fd_set argument. This was changed in this patch by removing this unnecessary "," after the last fd value and thus improving the estetics of the _newselect() "-strace" print. Implementation notes: The printing fix was made possible by using an existing function "get_comma()" which returns a "," or an empty string "" based on its argument (0 for "," and other for ""). Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200702160915.9517-1-Filip.Bozuta@syrmia.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r--linux-user/strace.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 13981341b3..5e38048643 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -541,6 +541,7 @@ static void
print_fdset(int n, abi_ulong target_fds_addr)
{
int i;
+ int first = 1;
qemu_log("[");
if( target_fds_addr ) {
@@ -555,9 +556,12 @@ print_fdset(int n, abi_ulong target_fds_addr)
return;
for (i=n; i>=0; i--) {
- if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >> (i & (TARGET_ABI_BITS - 1))) & 1)
- qemu_log("%d,", i);
+ if ((tswapal(target_fds[i / TARGET_ABI_BITS]) >>
+ (i & (TARGET_ABI_BITS - 1))) & 1) {
+ qemu_log("%s%d", get_comma(first), i);
+ first = 0;
}
+ }
unlock_user(target_fds, target_fds_addr, 0);
}
qemu_log("]");