Skip to content

Commit

Permalink
Auto merge of #542 - Susurrus:revents, r=fiveop
Browse files Browse the repository at this point in the history
Remove revents from PollFd::new

I could've used a `0i16`here as well but I liked the better semantics of `empty()`.
  • Loading branch information
homu committed Mar 3, 2017
2 parents 2755c58 + 80453b9 commit 5c90289
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,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
Expand Down
4 changes: 2 additions & 2 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5c90289

Please sign in to comment.