Add comment for the previous android bug fix

This commit is contained in:
LinkTed 2020-11-26 18:54:13 +01:00
parent 9b9dd4aeea
commit 8983752c12

View File

@ -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;
@ -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) {