From 93256cc1acaefb4c3ae0c13c5b979b298ba66279 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 1 May 1997 01:25:40 +0000 Subject: [PATCH] 1997-05-01 03:13 Ulrich Drepper * 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 . --- ChangeLog | 7 +++++++ sysdeps/libm-ieee754/s_cexp.c | 15 +++++++++++++++ sysdeps/unix/sysv/linux/shmat.c | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e94044fe3b..bc0007502e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1997-05-01 03:13 Ulrich Drepper + + * 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 . + 1997-04-30 17:35 Ulrich Drepper * math/libm-test.c: Implement test for exceptions. diff --git a/sysdeps/libm-ieee754/s_cexp.c b/sysdeps/libm-ieee754/s_cexp.c index 3181af08c7..6ba5b0a4a5 100644 --- a/sysdeps/libm-ieee754/s_cexp.c +++ b/sysdeps/libm-ieee754/s_cexp.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include +#include #include #include "math_private.h" @@ -59,6 +60,10 @@ __cexp (__complex__ double x) is not +-inf the result is NaN + iNaN. */ __real__ retval = __nan (""); __imag__ retval = __nan (""); + +#ifdef FE_INVALID + feraiseexcept (FE_INVALID); +#endif } } else if (rcls == FP_INFINITE) @@ -89,6 +94,11 @@ __cexp (__complex__ double x) { __real__ retval = HUGE_VAL; __imag__ retval = __nan (""); + +#ifdef FE_INVALID + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif } else { @@ -101,6 +111,11 @@ __cexp (__complex__ double x) /* If the real part is NaN the result is NaN + iNaN. */ __real__ retval = __nan (""); __imag__ retval = __nan (""); + +#ifdef FE_INVALID + if (rcls != FP_NAN || icls != FP_NAN) + feraiseexcept (FE_INVALID); +#endif } return retval; 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); }