Skip to content

Commit 8983752

Browse files
committed
Add comment for the previous android bug fix
1 parent 9b9dd4a commit 8983752

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/std/src/sys/unix/ext/net/ancillary.rs

+4
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ fn add_to_ancillary_data<T>(
160160
previous_cmsg = cmsg;
161161
cmsg = libc::CMSG_NXTHDR(&msg, cmsg);
162162
cfg_if::cfg_if! {
163+
// Android return the same pointer if it is the last cmsg.
164+
// Therefore, check it if the previous pointer is the same as the current one.
163165
if #[cfg(target_os = "android")] {
164166
if cmsg == previous_cmsg {
165167
break;
@@ -430,6 +432,8 @@ impl<'a> Iterator for Messages<'a> {
430432

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

0 commit comments

Comments
 (0)