提交 2a7e1245 编写于 作者: P Peter Maydell 提交者: Riku Voipio

linux-user/strace.c: Correct errno printing for mmap etc

Correct the printing of errnos for syscalls which are handled
via print_syscall_ret_addr (mmap, mmap2, brk, shmat): errnos
are returned as negative returned values at this level, not
via the host 'errno' variable.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NRiku Voipio <riku.voipio@linaro.org>
上级 962b289e
#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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册