patch-2.1.71 linux/kernel/signal.c

Next file: linux/net/Config.in
Previous file: linux/kernel/printk.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.70/linux/kernel/signal.c linux/kernel/signal.c
@@ -651,7 +651,6 @@
 {
 	sigset_t these;
 	struct timespec ts;
-	unsigned long expire;
 	siginfo_t info;
 	int ret, sig;
 
@@ -680,17 +679,19 @@
 	if (!sig) {
 		/* None ready -- temporarily unblock those we're interested
 		   in so that we'll be awakened when they arrive.  */
+		unsigned long expire;
 		sigset_t oldblocked = current->blocked;
 		sigandsets(&current->blocked, &current->blocked, &these);
 		recalc_sigpending(current);
 		spin_unlock_irq(&current->sigmask_lock);
 
+		expire = ~0UL;
 		if (uts) {
 			expire = (timespec_to_jiffies(&ts)
 				  + (ts.tv_sec || ts.tv_nsec));
 			expire += jiffies;
-			current->timeout = expire;
 		}
+		current->timeout = expire;
 
 		current->state = TASK_INTERRUPTIBLE;
 		schedule();
@@ -709,7 +710,11 @@
 				ret = -EFAULT;
 		}
 	} else {
-		ret = !uts || expire > jiffies ? -EINTR : -EAGAIN;
+		ret = -EAGAIN;
+		if (current->timeout != 0) {
+			current->timeout = 0;
+			ret = -EINTR;
+		}
 	}
 
 	return ret;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov