about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-05-01 01:25:40 +0000
committerUlrich Drepper <drepper@redhat.com>1997-05-01 01:25:40 +0000
commit93256cc1acaefb4c3ae0c13c5b979b298ba66279 (patch)
tree4d7abffa8bb98407bd0da791bea478c85982621e /sysdeps/unix/sysv
parent779ae82ecdf88b7ed7c1f00d3ed3a639671c3c8d (diff)
downloadglibc-93256cc1acaefb4c3ae0c13c5b979b298ba66279.tar.gz
glibc-93256cc1acaefb4c3ae0c13c5b979b298ba66279.tar.xz
glibc-93256cc1acaefb4c3ae0c13c5b979b298ba66279.zip
1997-05-01 03:13 Ulrich Drepper <drepper@cygnus.com>
	* sysdeps/unix/sysv/linux/shmat.c (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.
	Patch by Bruno Haible <haible@ilog.fr>.
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);
 }