about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-07-24 16:52:03 +0000
committerAndreas Jaeger <aj@suse.de>2000-07-24 16:52:03 +0000
commitefd70b34d9c2a882297f8824b906b95b2646042f (patch)
treef2570fde69aaad01ee4ede6e67e75230bdc78397 /sysdeps
parent72eb7808976fc1cf8747f36917767c089cb82d97 (diff)
downloadglibc-efd70b34d9c2a882297f8824b906b95b2646042f.tar.gz
glibc-efd70b34d9c2a882297f8824b906b95b2646042f.tar.xz
glibc-efd70b34d9c2a882297f8824b906b95b2646042f.zip
(__mmap64): Really fix check for offset.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/mmap64.c13
1 files 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))