From patchwork Sat Jan 2 03:45:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [15/15] linux-user: fix return value of mmap_frag() Date: Fri, 01 Jan 2010 17:45:33 -0000 From: "Kirill A. Shutemov" X-Patchwork-Id: 42005 Message-Id: <1262403933-26881-15-git-send-email-kirill@shutemov.name> To: qemu-devel@nongnu.org Cc: "Kirill A. Shutemov" mmap_frag() returns -1 on error and set errno. Signed-off-by: Kirill A. Shutemov --- linux-user/mmap.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) 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))