diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2016-08-05 19:26:23 +0100 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2016-08-05 19:26:23 +0100 |
| commit | dff62c19cef2eb12fac3d15552a98886edcaba44 (patch) | |
| tree | 678129aaccaa9c90736e1f57d71d6fb547a51bbc /src | |
| parent | 4c02363852e6ce41cf2da1b43a32cb7780a9b067 (diff) | |
| download | rust-dff62c19cef2eb12fac3d15552a98886edcaba44.tar.gz rust-dff62c19cef2eb12fac3d15552a98886edcaba44.zip | |
Handle RwLock reader count overflow
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(); } |
