From: Ulrich Drepper Date: Wed, 21 May 1997 00:05:52 +0000 (+0000) Subject: (shmat): For Linux-2.0 and up the kernel can return negative values. X-Git-Tag: cvs/libc-2_0_4~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=caf512f51a699944ae2407325bc7ad6b7ecca11c;p=thirdparty%2Fglibc.git (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. --- diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c index 2ac07f21d05..070b00c30f7 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); }