From: David Woodhouse <dwmw2@infradead.org>

I have just spotted a bug in the 'infinite' case there though -- if they've
asked for a timeout longer than MAX_INT64_SECONDS, then the 'else' case
should be setting timeout to -1 instead of to MAX_SCHEDULE_TIMEOUT.  I must
have missed that when I fixed the 24-day bug.  Let's do it like this...


Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 fs/select.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff -puN fs/select.c~pselect-ppoll-system-calls-fix fs/select.c
--- 25/fs/select.c~pselect-ppoll-system-calls-fix	Sun Jun 26 16:33:09 2005
+++ 25-akpm/fs/select.c	Sun Jun 26 16:37:44 2005
@@ -672,11 +672,19 @@ asmlinkage long sys_ppoll(struct pollfd 
 		if (copy_from_user(&ts, tsp, sizeof(ts)))
 			return -EFAULT;
 
-		if (ts.tv_sec < MAX_INT64_SECONDS) {
+#if BITS_PER_LONG > 32
+		/*
+		 * Only 64-bit platforms can overflow an int64_t, and if we let
+		 * GCC optimise this out for itself, it whinges that the
+		 * comparison is always false, and makes people unhappy
+		 */
+		if (ts.tv_sec >= MAX_INT64_SECONDS)
+			timeout = -1;	/* infinite */
+		else
+#endif
+		{
 			timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ);
 			timeout += ts.tv_sec * HZ;
-		} else {
-			timeout = MAX_SCHEDULE_TIMEOUT;
 		}
 	}
 
_