alpha-linux-user: Fix brk error return.
authorRichard Henderson <rth@twiddle.net>
Mon, 3 May 2010 17:07:49 +0000 (10:07 -0700)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 21 May 2010 16:22:20 +0000 (16:22 +0000)
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
linux-user/syscall.c

index ce728fa..746967a 100644 (file)
@@ -718,9 +718,17 @@ abi_long do_brk(abi_ulong new_brk)
                                         PROT_READ|PROT_WRITE,
                                         MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0));
 
-    if (!is_error(mapped_addr))
+#if defined(TARGET_ALPHA)
+    /* We (partially) emulate OSF/1 on Alpha, which requires we
+       return a proper errno, not an unchanged brk value.  */
+    if (is_error(mapped_addr)) {
+        return -TARGET_ENOMEM;
+    }
+#endif
+
+    if (!is_error(mapped_addr)) {
        target_brk = new_brk;
-    
+    }
     return target_brk;
 }