From 8983752c12c65e598dff704502ad1b0334d1daaa Mon Sep 17 00:00:00 2001 From: LinkTed Date: Thu, 26 Nov 2020 18:54:13 +0100 Subject: [PATCH] Add comment for the previous android bug fix --- library/std/src/sys/unix/ext/net/ancillary.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/std/src/sys/unix/ext/net/ancillary.rs b/library/std/src/sys/unix/ext/net/ancillary.rs index a94456b4e7a6b..2c91ba70dd0b5 100644 --- a/library/std/src/sys/unix/ext/net/ancillary.rs +++ b/library/std/src/sys/unix/ext/net/ancillary.rs @@ -160,6 +160,8 @@ fn add_to_ancillary_data( 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; @@ -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) {