Patchwork [11/18] syscall: really return ret code

login
register
mail settings
Submitter Riku Voipio
Date June 20, 2011, 4:20 p.m.
Message ID <469e6f24b804ea2031d14c84b11ef6f611cd2f8b.1308583801.git.riku.voipio@iki.fi>
Download mbox | patch
Permalink /patch/101159/
State New
Headers show

Comments

Riku Voipio - June 20, 2011, 4:20 p.m.
From: Juan Quintela <quintela@redhat.com>

We assign ret with the error code, but then return 0 unconditionally.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
 linux-user/syscall.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 362cc63..57d9233 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3779,10 +3779,10 @@  static abi_long do_get_thread_area(CPUX86State *env, abi_ulong ptr)
 #ifndef TARGET_ABI32
 static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)
 {
-    abi_long ret;
+    abi_long ret = 0;
     abi_ulong val;
     int idx;
-    
+
     switch(code) {
     case TARGET_ARCH_SET_GS:
     case TARGET_ARCH_SET_FS:
@@ -3801,13 +3801,13 @@  static abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr)
             idx = R_FS;
         val = env->segs[idx].base;
         if (put_user(val, addr, abi_ulong))
-            return -TARGET_EFAULT;
+            ret = -TARGET_EFAULT;
         break;
     default:
         ret = -TARGET_EINVAL;
         break;
     }
-    return 0;
+    return ret;
 }
 #endif