diff --git a/CHANGELOG.md b/CHANGELOG.md index 26c016f894..fe9f94dd3b 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 8a3de5f1da..afc5bd9c95 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 13a95d2cde..6d30f26525 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);