summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-21 00:05:52 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-21 00:05:52 +0000
commitcaf512f51a699944ae2407325bc7ad6b7ecca11c (patch)
tree081cd9a1b5c2c61c83e9bcd712ae2923ba34e192 /sysdeps/unix/sysv
parentf301b575428f237ba2582a6c57dddab1b2a2f501 (diff)
downloadglibc-caf512f51a699944ae2407325bc7ad6b7ecca11c.tar
glibc-caf512f51a699944ae2407325bc7ad6b7ecca11c.tar.gz
glibc-caf512f51a699944ae2407325bc7ad6b7ecca11c.tar.bz2
glibc-caf512f51a699944ae2407325bc7ad6b7ecca11c.zip
(shmat): For Linux-2.0 and up the kernel can return negative values.
Only fail when return value is in range in range which is never returned as valid address.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/shmat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 2ac07f21d0..070b00c30f 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -33,5 +33,6 @@ shmat (shmid, shmaddr, shmflg)
unsigned long raddr;
retval = __ipc (IPCOP_shmat, shmid, shmflg, (int) &raddr, shmaddr);
- return retval < 0 ? (void *) retval : (void *) raddr;
+ return ((unsigned long int) retval > -(unsigned long int) SHMLBA
+ ? (void *) retval : (void *) raddr);
}