diff options
author | cls%seawood.org <devnull@localhost> | 2001-08-14 00:59:49 +0000 |
---|---|---|
committer | cls%seawood.org <devnull@localhost> | 2001-08-14 00:59:49 +0000 |
commit | 79edb2730b6da27bfabf28794fbe140d2cfff748 (patch) | |
tree | a83c35b262e52123bfb69825f0424fa588d8acba | |
parent | 27951495364c22141dec81e2c75e577b711c7bb3 (diff) | |
download | nspr-hg-NSPRPUB_CLIENT_BRANCH.tar.gz |
_MD_pr_poll should exit with error if select returns -1 and errno is not EINTR.NSPRPUB_CLIENT_BRANCH
Bug #70808 r=darin
-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; } |