forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#83374 - reyk:fix/bsd-ancillary, r=joshtriplett
unix: Fix feature(unix_socket_ancillary_data) on macos and other BSDs This adds support for CMSG handling on macOS and fixes it on OpenBSD and possibly other BSDs. When traversing the CMSG list, the previous code had an exception for Android where the next element after the last pointer could point to the first pointer instead of NULL. This is actually not specific to Android: the `libc::CMSG_NXTHDR` implementation for Linux and emscripten have a special case to return NULL when the length of the previous element is zero; most other implementations simply return the previous element plus a zero offset in this case. This MR makes the check non-optional which fixes CMSG handling and a possible endless loop on such systems; tested with file descriptor passing on OpenBSD, Linux, and macOS. This MR additionally adds `SocketAncillary::is_empty` because clippy is right that it should be added. This belongs to the `feature(unix_socket_ancillary_data)` tracking issue: rust-lang#76915 r? `@joshtriplett`
- Loading branch information
Showing
1 changed file
with
34 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters