Skip to content

Commit

Permalink
commons: close fds we dup-ed after sending them
Browse files Browse the repository at this point in the history
  • Loading branch information
elinorbgr committed Jan 25, 2019
1 parent 6d7e2c0 commit cea0711
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wayland-commons/src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ impl BufferedSocket {
let bytes = unsafe { ::std::slice::from_raw_parts(words.as_ptr() as *const u8, words.len() * 4) };
let fds = self.out_fds.get_contents();
self.socket.send_msg(bytes, fds)?;
for &fd in fds {
// once the fds are sent, we can close them
let _ = ::nix::unistd::close(fd);
}
}
self.out_data.clear();
self.out_fds.clear();
Expand Down

0 comments on commit cea0711

Please sign in to comment.