diff options
-rw-r--r-- | pr/src/md/beos/bfile.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/pr/src/md/beos/bfile.c b/pr/src/md/beos/bfile.c index 321c9274..3f078877 100644 --- a/pr/src/md/beos/bfile.c +++ b/pr/src/md/beos/bfile.c @@ -1,4 +1,4 @@ -/* -*- Mode: C++; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 8; c-basic-offset: 8 -*- */ /* * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "MPL"); you may not use this file except in @@ -565,15 +565,18 @@ _MD_pr_poll (PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) n = select(maxfd + 1, &rd, &wr, 0, tvp); - /*printf("POLL: maxfd = %d, select returns %d\n", maxfd, n);*/ - if ((n <= 0) && (timeout != PR_INTERVAL_NO_TIMEOUT)) + /*printf("POLL: maxfd = %d, select returns %d, errno = %d %s\n", maxfd, n, errno, strerror(errno));*/ + if (n == 0 || (n < 0 && errno == EINTR)) { + if (timeout != PR_INTERVAL_NO_TIMEOUT) + { timeout -= PR_IntervalNow() - start; if(timeout <= 0) { /* timed out */ n = 0; } + } } } while(n < 0 && errno == EINTR); @@ -662,10 +665,13 @@ _MD_pr_poll (PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) } } + } else if (n < 0) { + /* hit error that's not EINTR. */ + rc = -1; } } - /*printf("POLL: exiting _MD_pr_poll\n");*/ + /*printf("POLL: exiting _MD_pr_poll with %d\n", rc);*/ return rc; } |