From efd70b34d9c2a882297f8824b906b95b2646042f Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 24 Jul 2000 16:52:03 +0000 Subject: [PATCH] (__mmap64): Really fix check for offset. --- sysdeps/unix/sysv/linux/powerpc/mmap64.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sysdeps/unix/sysv/linux/powerpc/mmap64.c b/sysdeps/unix/sysv/linux/powerpc/mmap64.c index 5b7f1c47a9..f799b05106 100644 --- a/sysdeps/unix/sysv/linux/powerpc/mmap64.c +++ b/sysdeps/unix/sysv/linux/powerpc/mmap64.c @@ -40,15 +40,13 @@ __ptr_t __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset) { #ifdef __NR_mmap2 - if (! (offset & PAGE_MASK)) - { - __set_errno (EINVAL); - return MAP_FAILED; - } - + if ( # ifndef __ASSUME_MMAP2_SYSCALL - if (! have_no_mmap2) + ! have_no_mmap2 && +# endif + ! (offset & ~PAGE_MASK)) { +# ifndef __ASSUME_MMAP2_SYSCALL int saved_errno = errno; # endif /* This will be always 12, no matter what page size is. */ @@ -67,6 +65,7 @@ __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset) # ifndef __ASSUME_MMAP2_SYSCALL __set_errno (saved_errno); have_no_mmap2 = 1; +# endif } #endif if (offset != (off_t) offset || (offset + len) != (off_t) (offset + len))