Skip to content

Commit

Permalink
Fix an incorrect lifetime in the return value of recvmsg
Browse files Browse the repository at this point in the history
Fixes #2083
  • Loading branch information
asomers committed Aug 11, 2023
1 parent 6fb3a8f commit 6c095f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
`SockaddrIn6::from<std::net::SockaddrV6>`, `IpMembershipRequest::new`, and
`Ipv6MembershipRequest::new` with future Rust versions.
([#2061](https://github.com/nix-rust/nix/pull/2061))
- Fixed an incorrect lifetime returned from `recvmsg`.
([#2095](https://github.com/nix-rust/nix/pull/2095))

### Removed

Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ fn pack_mhdr_to_send<'a, I, C, S>(
/// [recvmsg(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html)
pub fn recvmsg<'a, 'outer, 'inner, S>(fd: RawFd, iov: &'outer mut [IoSliceMut<'inner>],
mut cmsg_buffer: Option<&'a mut Vec<u8>>,
flags: MsgFlags) -> Result<RecvMsg<'a, 'inner, S>>
flags: MsgFlags) -> Result<RecvMsg<'a, 'outer, S>>
where S: SockaddrLike + 'a,
'inner: 'outer
{
Expand Down
3 changes: 2 additions & 1 deletion test/sys/test_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ pub fn test_recvmsg_sockaddr_un() {

// Receive the message
let mut recv_buffer = [0u8; 32];
let mut iov = [std::io::IoSliceMut::new(&mut recv_buffer)];
let received = socket::recvmsg(
sock.as_raw_fd(),
&mut [std::io::IoSliceMut::new(&mut recv_buffer)],
&mut iov,
None,
MsgFlags::empty(),
)
Expand Down

0 comments on commit 6c095f0

Please sign in to comment.