Skip to content

Commit c59d63c

Browse files
committed
Remove revents from PollFd::new
revents is an output field so regardless of what value it is set to it will be overwritten by many of the function calls that take a PollFd. The only value that makes sense for the caller to pass in in `EventFlags::empty()` so we just hardcode that instead of making the caller do it.
1 parent 70a1bd4 commit c59d63c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

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

99102
### Fixed
100103
- 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
}

0 commit comments

Comments
 (0)