diff options
author | Andreas Schwab <schwab@redhat.com> | 2010-04-12 13:40:20 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2010-04-12 13:40:20 +0200 |
commit | 1fd194fb757480a11ebd877e17dd627c90d76dd1 (patch) | |
tree | 9ad22d95dd8673bc036d14b0055a8dcd6febe09e /sysdeps | |
parent | 4ac4e460b116fb6da6e80124f4c4f6968eb86341 (diff) | |
parent | ea42a20caed5b343ff20a0d4622ae6c17b77161b (diff) |
Merge remote branch 'origin/master' into fedora/master
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/s_cprojl.c | 22 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/getlogin_r.c | 16 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/fallocate.c | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/fallocate64.c | 8 |
4 files changed, 31 insertions, 23 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c index 2167db3d91..b2a09ae885 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_cprojl.c @@ -1,5 +1,5 @@ /* Compute projection of complex long double value to Riemann sphere. - Copyright (C) 1997,1999,2006 Free Software Foundation, Inc. + Copyright (C) 1997,1999,2006,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -25,30 +25,18 @@ __complex__ long double __cprojl (__complex__ long double x) { - __complex__ long double res; - if (isnan (__real__ x) && isnan (__imag__ x)) return x; else if (!isfinite (__real__ x) || !isfinite (__imag__ x)) { + __complex__ long double res; + __real__ res = INFINITY; __imag__ res = __copysignl (0.0, __imag__ x); - } - else - { - long double den = (__real__ x * __real__ x + __imag__ x * __imag__ x - + 1.0); - - __real__ res = (2.0 * __real__ x) / den; - __imag__ res = (2.0 * __imag__ x) / den; - /* __gcc_qmul does not respect -0.0 so we need the following fixup. */ - if (__real__ x == 0.0) - __real__ res = __real__ x; - if (__imag__ x == 0.0) - __imag__ res = __imag__ x; + return res; } - return res; + return x; } long_double_symbol (libm, __cprojl, cprojl); diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c index d07846ccb8..d9c66fe259 100644 --- a/sysdeps/unix/sysv/linux/getlogin_r.c +++ b/sysdeps/unix/sysv/linux/getlogin_r.c @@ -37,13 +37,20 @@ __getlogin_r_loginuid (name, namesize) if (fd == -1) return 1; - ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, name, namesize)); + /* We are reading a 32-bit number. 12 bytes are enough for the text + representation. If not, something is wrong. */ + char uidbuf[12]; + ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, uidbuf, + sizeof (uidbuf))); close_not_cancel_no_status (fd); uid_t uid; char *endp; if (n <= 0 - || (uid = strtoul (name, &endp, 10), endp == name || *endp != '\0')) + || n == sizeof (uidbuf) + || (uidbuf[n] = '\0', + uid = strtoul (uidbuf, &endp, 10), + endp == uidbuf || *endp != '\0')) return 1; size_t buflen = 1024; @@ -84,8 +91,9 @@ __getlogin_r_loginuid (name, namesize) } -/* Return the login name of the user, or NULL if it can't be determined. - The returned pointer, if not NULL, is good only until the next call. */ +/* Return at most NAME_LEN characters of the login name of the user in NAME. + If it cannot be determined or some other error occurred, return the error + code. Otherwise return 0. */ int getlogin_r (name, namesize) diff --git a/sysdeps/unix/sysv/linux/i386/fallocate.c b/sysdeps/unix/sysv/linux/i386/fallocate.c index 14e788386c..1434a833f9 100644 --- a/sysdeps/unix/sysv/linux/i386/fallocate.c +++ b/sysdeps/unix/sysv/linux/i386/fallocate.c @@ -30,7 +30,13 @@ int fallocate (int fd, int mode, __off_t offset, __off_t len) { #ifdef __NR_fallocate - return __call_fallocate (fd, mode, offset, len); + int err = __call_fallocate (fd, mode, offset, len); + if (__builtin_expect (err, 0)) + { + __set_errno (err); + err = -1; + } + return err; #else __set_errno (ENOSYS); return -1; diff --git a/sysdeps/unix/sysv/linux/i386/fallocate64.c b/sysdeps/unix/sysv/linux/i386/fallocate64.c index 85f315c9b6..063bab06e9 100644 --- a/sysdeps/unix/sysv/linux/i386/fallocate64.c +++ b/sysdeps/unix/sysv/linux/i386/fallocate64.c @@ -30,7 +30,13 @@ int fallocate64 (int fd, int mode, __off64_t offset, __off64_t len) { #ifdef __NR_fallocate - return __call_fallocate (fd, mode, offset, len); + int err = __call_fallocate (fd, mode, offset, len); + if (__builtin_expect (err, 0)) + { + __set_errno (err); + err = -1; + } + return err; #else __set_errno (ENOSYS); return -1; |