Skip to content

Commit 600033d

Browse files
alexanderkjallcathay4t
authored andcommitted
make testsuite pass on bigendian
1 parent 3a49d41 commit 600033d

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/mio.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl Source for Socket {
3535
}
3636
}
3737

38+
#[cfg(target_endian = "little")]
3839
#[cfg(test)]
3940
mod tests {
4041
use super::*;

src/socket.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ impl Socket {
426426
libc::SOL_NETLINK,
427427
libc::NETLINK_PKTINFO,
428428
)?;
429-
Ok(res == 1)
429+
Ok(res != 0)
430430
}
431431

432432
pub fn add_membership(&self, group: u32) -> Result<()> {
@@ -473,7 +473,7 @@ impl Socket {
473473
libc::SOL_NETLINK,
474474
libc::NETLINK_BROADCAST_ERROR,
475475
)?;
476-
Ok(res == 1)
476+
Ok(res != 0)
477477
}
478478

479479
/// `NETLINK_NO_ENOBUFS` (since Linux 2.6.30). This flag can be used by
@@ -494,7 +494,7 @@ impl Socket {
494494
libc::SOL_NETLINK,
495495
libc::NETLINK_NO_ENOBUFS,
496496
)?;
497-
Ok(res == 1)
497+
Ok(res != 0)
498498
}
499499

500500
/// `NETLINK_LISTEN_ALL_NSID` (since Linux 4.2). When set, this socket will
@@ -518,7 +518,7 @@ impl Socket {
518518
libc::SOL_NETLINK,
519519
libc::NETLINK_LISTEN_ALL_NSID,
520520
)?;
521-
Ok(res == 1)
521+
Ok(res != 0)
522522
}
523523

524524
/// `NETLINK_CAP_ACK` (since Linux 4.2). The kernel may fail to allocate the
@@ -543,7 +543,7 @@ impl Socket {
543543
libc::SOL_NETLINK,
544544
libc::NETLINK_CAP_ACK,
545545
)?;
546-
Ok(res == 1)
546+
Ok(res != 0)
547547
}
548548

549549
/// `NETLINK_EXT_ACK`
@@ -565,7 +565,7 @@ impl Socket {
565565
libc::SOL_NETLINK,
566566
libc::NETLINK_EXT_ACK,
567567
)?;
568-
Ok(res == 1)
568+
Ok(res != 0)
569569
}
570570

571571
/// Sets socket receive buffer in bytes.

0 commit comments

Comments
 (0)