diff mbox

[14/16,v1] linux-user: main: Use negative qemu errno for syscall return errno

Message ID BLU436-SMTP72316C7FDD498D1F8835D4B9660@phx.gbl
State New
Headers show

Commit Message

Chen Gang Aug. 20, 2015, 9:47 p.m. UTC
The qemu errno is negative of normal errno, so revert it before return
from syscall, or the related user mode checking will fail, e.g. cp/mv
will call stat64 and check errno ENOENT (not -ENOENT).

Signed-of-by Chen Gang <gang.chen.5i5j@gmail.com>
---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 253aade..f0bda09 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3654,7 +3654,7 @@  void cpu_loop(CPUTLGState *env)
                                                 env->regs[4], env->regs[5],
                                                 env->regs[6], env->regs[7]);
             env->regs[TILEGX_R_ERR] = TILEGX_IS_ERRNO(env->regs[TILEGX_R_RE])
-                                                      ? env->regs[TILEGX_R_RE]
+                                                      ? - env->regs[TILEGX_R_RE]
                                                       : 0;
             break;
         case TILEGX_EXCP_OPCODE_EXCH: