summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@imgtec.com>2014-03-03 15:07:41 +0100
committerRiku Voipio <riku.voipio@linaro.org>2014-03-03 23:08:14 +0200
commit974a196d7fc9f2f5553589b0022226b877e5c9b1 (patch)
treefa4f3a42adfa7877509534c907328ddea0b8b34a /linux-user/syscall.c
parentf19e00d776b781bfb0067b9b20a592440fd2990e (diff)
downloadfocaccia-qemu-974a196d7fc9f2f5553589b0022226b877e5c9b1.tar.gz
focaccia-qemu-974a196d7fc9f2f5553589b0022226b877e5c9b1.zip
linux-user: translate signal number on return from sigtimedwait
On success, sigtimedwait() returns a signal number that needs to be
translated from a host value to a target value.

This change also fixes issues with sigwait (that is implemented using
sigtimedwait()).

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1f64867eba..e2c10cc0bd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6185,11 +6185,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
                 puts = NULL;
             }
             ret = get_errno(sigtimedwait(&set, &uinfo, puts));
-            if (!is_error(ret) && arg2) {
-                if (!(p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t), 0)))
-                    goto efault;
-                host_to_target_siginfo(p, &uinfo);
-                unlock_user(p, arg2, sizeof(target_siginfo_t));
+            if (!is_error(ret)) {
+                if (arg2) {
+                    p = lock_user(VERIFY_WRITE, arg2, sizeof(target_siginfo_t),
+                                  0);
+                    if (!p) {
+                        goto efault;
+                    }
+                    host_to_target_siginfo(p, &uinfo);
+                    unlock_user(p, arg2, sizeof(target_siginfo_t));
+                }
+                ret = host_to_target_signal(ret);
             }
         }
         break;