summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-05-18 14:30:49 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2011-05-18 14:30:49 +0000
commite9d94bb485578797a67a3ef6dae7ac9e3635e963 (patch)
tree04991ea2da24b7448dcdddda044c36e1ac9d5189 /libc/misc
parentbc5b8c65ef17547cbab9141d66798bbb3cae9c2a (diff)
downloadeglibc2-e9d94bb485578797a67a3ef6dae7ac9e3635e963.tar.gz
Merge changes between r13831 and r13882 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@13883 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/error.c6
-rw-r--r--libc/misc/pselect.c14
2 files changed, 16 insertions, 4 deletions
diff --git a/libc/misc/error.c b/libc/misc/error.c
index e0552d3a8..7a879fa4b 100644
--- a/libc/misc/error.c
+++ b/libc/misc/error.c
@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2006, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -277,7 +277,9 @@ error_at_line (int status, int errnum, const char *file_name,
if (old_line_number == line_number
&& (file_name == old_file_name
- || strcmp (old_file_name, file_name) == 0))
+ || (old_file_name != NULL
+ && file_name != NULL
+ && strcmp (old_file_name, file_name) == 0)))
/* Simply return and print nothing. */
return;
diff --git a/libc/misc/pselect.c b/libc/misc/pselect.c
index 80cf8be4b..e29d7b36a 100644
--- a/libc/misc/pselect.c
+++ b/libc/misc/pselect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1998,2001,2002,2003,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1998,2001-2003,2006,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -43,7 +43,17 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
precision and therefore the `pselect` should be available. But
for now it is hardly found. */
if (timeout != NULL)
- TIMESPEC_TO_TIMEVAL (&tval, timeout);
+ {
+ /* Catch bugs which would be hidden by the TIMESPEC_TO_TIMEVAL
+ computations. The division by 1000 truncates values. */
+ if (__builtin_expect (timeout->tv_nsec < 0, 0))
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ TIMESPEC_TO_TIMEVAL (&tval, timeout);
+ }
/* The setting and restoring of the signal mask and the select call
should be an atomic operation. This can't be done without kernel