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: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
#include <stdio.h>
-#include <errno.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/sem.h>
{
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);
}