aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/strace.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 269481e7ae..05a0d3e9d7 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1,5 +1,4 @@
#include <stdio.h>
-#include <errno.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/sem.h>
@@ -286,11 +285,11 @@ print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
{
char *errstr = NULL;
- if (ret == -1) {
- errstr = target_strerror(errno);
+ if (ret < 0) {
+ errstr = target_strerror(-ret);
}
- if ((ret == -1) && errstr) {
- gemu_log(" = -1 errno=%d (%s)\n", errno, errstr);
+ if (errstr) {
+ gemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
} else {
gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}