Skip to content

Commit

Permalink
Add comment for the previous android bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkTed committed Nov 26, 2020
1 parent 9b9dd4a commit 8983752
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/std/src/sys/unix/ext/net/ancillary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ fn add_to_ancillary_data<T>(
previous_cmsg = cmsg;
cmsg = libc::CMSG_NXTHDR(&msg, cmsg);
cfg_if::cfg_if! {
// Android return the same pointer if it is the last cmsg.
// Therefore, check it if the previous pointer is the same as the current one.
if #[cfg(target_os = "android")] {
if cmsg == previous_cmsg {
break;
Expand Down Expand Up @@ -430,6 +432,8 @@ impl<'a> Iterator for Messages<'a> {

let cmsg = cmsg.as_ref()?;
cfg_if::cfg_if! {
// Android return the same pointer if it is the last cmsg.
// Therefore, check it if the previous pointer is the same as the current one.
if #[cfg(target_os = "android")] {
if let Some(current) = self.current {
if eq(current, cmsg) {
Expand Down

0 comments on commit 8983752

Please sign in to comment.