Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9bf084f70ffde6521d113593b89461a5bd2a303b
Commit:     9bf084f70ffde6521d113593b89461a5bd2a303b
Parent:     252e5725cfb55a89e54888317856903fef9d5031
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 23:26:18 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 08:42:48 2007 -0700

    do_poll: return -EINTR when signalled
    
    do_poll() checks signal_pending() but returns 0 when interrupted.  This 
means
    the caller has to check signal_pending() again.
    
    Change it to return -EINTR when signal_pending() and count == 0.
    
    Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Cc: Davide Libenzi <[EMAIL PROTECTED]>
    Cc: Vadim Lobanov <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/select.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/select.c b/fs/select.c
index 41c3571..e2fd58f 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -586,7 +586,7 @@ static int do_poll(unsigned int nfds,  struct poll_list 
*list,
        /* Optimise the no-wait case */
        if (!(*timeout))
                pt = NULL;
- 
+
        for (;;) {
                struct poll_list *walk;
                long __timeout;
@@ -616,10 +616,12 @@ static int do_poll(unsigned int nfds,  struct poll_list 
*list,
                 * a poll_table to them on the next loop iteration.
                 */
                pt = NULL;
-               if (count || !*timeout || signal_pending(current))
-                       break;
-               count = wait->error;
-               if (count)
+               if (!count) {
+                       count = wait->error;
+                       if (signal_pending(current))
+                               count = -EINTR;
+               }
+               if (count || !*timeout)
                        break;
 
                if (*timeout < 0) {
@@ -689,8 +691,6 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int 
nfds, s64 *timeout)
 
        poll_initwait(&table);
        fdcount = do_poll(nfds, head, &table, timeout);
-       if (!fdcount && signal_pending(current))
-               fdcount = -EINTR;
        poll_freewait(&table);
 
        for (walk = head; walk; walk = walk->next) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to