Skip to content

Commit 5c90289

Browse files
committed
Auto merge of #542 - Susurrus:revents, r=fiveop
Remove revents from PollFd::new I could've used a `0i16`here as well but I liked the better semantics of `empty()`.
2 parents 2755c58 + 80453b9 commit 5c90289

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
9797
- Exposed all fcntl(2) operations at the module level, so they can be
9898
imported direclty instead of via `FcntlArg` enum.
9999
([#541](https://github.com/nix-rust/nix/pull/541))
100+
- Removed `revents` argument from `PollFd::new()` as it's an output argument and
101+
will be overwritten regardless of value.
102+
([#542](https://github.com/nix-rust/nix/pull/542)
100103

101104
### Fixed
102105
- Fixed multiple issues with Unix domain sockets on non-Linux OSes

src/poll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ pub struct PollFd {
1313
}
1414

1515
impl PollFd {
16-
pub fn new(fd: libc::c_int, events: EventFlags, revents: EventFlags) -> PollFd {
16+
pub fn new(fd: libc::c_int, events: EventFlags) -> PollFd {
1717
PollFd {
1818
pollfd: libc::pollfd {
1919
fd: fd,
2020
events: events.bits(),
21-
revents: revents.bits(),
21+
revents: EventFlags::empty().bits(),
2222
},
2323
}
2424
}

test/test_poll.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use nix::unistd::{write, pipe};
44
#[test]
55
fn test_poll() {
66
let (r, w) = pipe().unwrap();
7-
let mut fds = [PollFd::new(r, POLLIN, EventFlags::empty())];
7+
let mut fds = [PollFd::new(r, POLLIN)];
88

99
let nfds = poll(&mut fds, 100).unwrap();
1010
assert_eq!(nfds, 0);

0 commit comments

Comments
 (0)