From 2039b1b0dc4a8b5325dcfb60c3f1fe4abf9720bb Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 12 Mar 2020 17:55:30 +0100 Subject: [PATCH] linux-user: fix socket() strace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit print_socket_type() doesn't manage flags and the correct type cannot be displayed Signed-off-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20200312165530.53450-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- linux-user/strace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/linux-user/strace.c b/linux-user/strace.c index 4f7130b2ff6..69232f7e27b 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -444,7 +444,7 @@ print_socket_domain(int domain) static void print_socket_type(int type) { - switch (type) { + switch (type & TARGET_SOCK_TYPE_MASK) { case TARGET_SOCK_DGRAM: qemu_log("SOCK_DGRAM"); break; @@ -464,6 +464,12 @@ print_socket_type(int type) qemu_log("SOCK_PACKET"); break; } + if (type & TARGET_SOCK_CLOEXEC) { + qemu_log("|SOCK_CLOEXEC"); + } + if (type & TARGET_SOCK_NONBLOCK) { + qemu_log("|SOCK_NONBLOCK"); + } } static void -- 2.39.2