diff options
| author | bors <bors@rust-lang.org> | 2016-08-06 19:50:48 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-06 19:50:48 -0700 |
| commit | 877dfeb572e330026fc4b4114f16a411c44dc328 (patch) | |
| tree | 78b94cfcd3cbed7f5f70f75215ab47def6eab1b9 /src | |
| parent | ddf92ffae4b8fc74474241f064f41f09db585ed8 (diff) | |
| parent | dff62c19cef2eb12fac3d15552a98886edcaba44 (diff) | |
| download | rust-877dfeb572e330026fc4b4114f16a411c44dc328.tar.gz rust-877dfeb572e330026fc4b4114f16a411c44dc328.zip | |
Auto merge of #35378 - Amanieu:rwlock_eagain, r=alexcrichton
Handle RwLock reader count overflow `pthread_rwlock_rdlock` may return `EAGAIN` if the maximum reader count overflows. We shouldn't return a successful lock in that case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/sys/unix/rwlock.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/rwlock.rs b/src/libstd/sys/unix/rwlock.rs index fbd4e1d1208..08aeb5fb8cc 100644 --- a/src/libstd/sys/unix/rwlock.rs +++ b/src/libstd/sys/unix/rwlock.rs @@ -50,7 +50,9 @@ impl RWLock { // the implementation allows recursive locking. The POSIX standard // doesn't require recursivly locking a rwlock to deadlock, but we can't // allow that because it could lead to aliasing issues. - if r == libc::EDEADLK || *self.write_locked.get() { + if r == libc::EAGAIN { + panic!("rwlock maximum reader count exceeded"); + } else if r == libc::EDEADLK || *self.write_locked.get() { if r == 0 { self.raw_unlock(); } |
