summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/poll.rs4
-rw-r--r--test/test_poll.rs2
3 files changed, 6 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26c016f8..fe9f94dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -95,6 +95,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Exposed all fcntl(2) operations at the module level, so they can be
imported direclty instead of via `FcntlArg` enum.
([#541](https://github.com/nix-rust/nix/pull/541))
+- Removed `revents` argument from `PollFd::new()` as it's an output argument and
+ will be overwritten regardless of value.
+ ([#542](https://github.com/nix-rust/nix/pull/542)
### Fixed
- Fixed multiple issues with Unix domain sockets on non-Linux OSes
diff --git a/src/poll.rs b/src/poll.rs
index 8a3de5f1..afc5bd9c 100644
--- a/src/poll.rs
+++ b/src/poll.rs
@@ -13,12 +13,12 @@ pub struct PollFd {
}
impl PollFd {
- pub fn new(fd: libc::c_int, events: EventFlags, revents: EventFlags) -> PollFd {
+ pub fn new(fd: libc::c_int, events: EventFlags) -> PollFd {
PollFd {
pollfd: libc::pollfd {
fd: fd,
events: events.bits(),
- revents: revents.bits(),
+ revents: EventFlags::empty().bits(),
},
}
}
diff --git a/test/test_poll.rs b/test/test_poll.rs
index 13a95d2c..6d30f265 100644
--- a/test/test_poll.rs
+++ b/test/test_poll.rs
@@ -4,7 +4,7 @@ use nix::unistd::{write, pipe};
#[test]
fn test_poll() {
let (r, w) = pipe().unwrap();
- let mut fds = [PollFd::new(r, POLLIN, EventFlags::empty())];
+ let mut fds = [PollFd::new(r, POLLIN)];
let nfds = poll(&mut fds, 100).unwrap();
assert_eq!(nfds, 0);