]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(shmat): For Linux-2.0 and up the kernel can return negative values.
authorUlrich Drepper <drepper@redhat.com>
Wed, 21 May 1997 00:05:52 +0000 (00:05 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 21 May 1997 00:05:52 +0000 (00:05 +0000)
Only fail when return value is in range in range which is never
returned as valid address.

sysdeps/unix/sysv/linux/shmat.c

index 2ac07f21d05ef73ce61bbd9a3db2294cd3fa335f..070b00c30f74bda04e2b0a4d65ef8c29f1fa4c21 100644 (file)
@@ -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);
 }