diff mbox

[15/15] linux-user: fix return value of mmap_frag()

Message ID 1262403933-26881-15-git-send-email-kirill@shutemov.name
State New
Headers show

Commit Message

Kirill A . Shutemov Jan. 2, 2010, 3:45 a.m. UTC
mmap_frag() returns -1 on error and set errno.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 linux-user/mmap.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index c1c7e48..47bc339 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -242,8 +242,10 @@  static int mmap_frag(abi_ulong real_start,
         /* msync() won't work here, so we return an error if write is
            possible while it is a shared mapping */
         if ((flags & MAP_TYPE) == MAP_SHARED &&
-            (prot & PROT_WRITE))
-            return -EINVAL;
+            (prot & PROT_WRITE)) {
+            errno = -EINVAL;
+            return -1;
+        }
 
         /* adjust protection to be able to read */
         if (!(prot1 & PROT_WRITE))