diff options
author | Jarred Allen <jarred@moveparallel.com> | 2023-07-17 11:34:00 -0700 |
---|---|---|
committer | Jarred Allen <jarred@moveparallel.com> | 2023-07-17 11:34:00 -0700 |
commit | 23125cbb1b3e5606513de48ffc62bff58fc135e8 (patch) | |
tree | 9b53d6c6b42663257cd32810fc3c28d30e575bc3 | |
parent | 012e788adcd8a41bdb028b5a6dc6dd1738dd2f9c (diff) | |
parent | c3e6e6a14244d68a9715ff75dc844d6c856049b9 (diff) | |
download | nix-23125cbb1b3e5606513de48ffc62bff58fc135e8.zip |
Merge branch 'master' into set-sockaddr-length-linux
-rw-r--r-- | .cirrus.yml | 48 | ||||
-rw-r--r-- | CHANGELOG.md | 19 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/macros.rs | 2 | ||||
-rw-r--r-- | src/mount/bsd.rs | 6 | ||||
-rw-r--r-- | src/mount/linux.rs | 4 | ||||
-rw-r--r-- | src/mqueue.rs | 2 | ||||
-rw-r--r-- | src/sys/event.rs | 6 | ||||
-rw-r--r-- | src/sys/personality.rs | 5 | ||||
-rw-r--r-- | src/sys/socket/addr.rs | 19 | ||||
-rw-r--r-- | src/sys/socket/mod.rs | 10 | ||||
-rw-r--r-- | src/sys/stat.rs | 4 | ||||
-rw-r--r-- | src/sys/statvfs.rs | 1 | ||||
-rw-r--r-- | src/sys/termios.rs | 6 | ||||
-rw-r--r-- | src/sys/time.rs | 2 | ||||
-rw-r--r-- | src/unistd.rs | 4 | ||||
-rw-r--r-- | test/sys/test_socket.rs | 6 | ||||
-rw-r--r-- | test/test_fcntl.rs | 2 | ||||
-rw-r--r-- | test/test_sendfile.rs | 8 |
20 files changed, 86 insertions, 73 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 1ffe4611..f3624f4b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -8,29 +8,28 @@ env: RUSTFLAGS: -D warnings RUSTDOCFLAGS: -D warnings TOOL: cargo - # The MSRV - TOOLCHAIN: 1.63.0 + MSRV: 1.63.0 ZFLAGS: # Tests that don't require executing the build binaries build: &BUILD build_script: - . $HOME/.cargo/env || true - - $TOOL +$TOOLCHAIN -Vv - - rustc +$TOOLCHAIN -Vv - - $TOOL +$TOOLCHAIN $BUILD $ZFLAGS --target $TARGET --all-targets - - $TOOL +$TOOLCHAIN doc $ZFLAGS --no-deps --target $TARGET - - $TOOL +$TOOLCHAIN clippy $ZFLAGS --target $TARGET --all-targets -- -D warnings + - $TOOL -Vv + - rustc -Vv + - $TOOL $BUILD $ZFLAGS --target $TARGET --all-targets + - $TOOL doc $ZFLAGS --no-deps --target $TARGET + - $TOOL clippy $ZFLAGS --target $TARGET --all-targets -- -D warnings - if [ -z "$NOHACK" ]; then mkdir -p $HOME/.cargo/bin; export PATH=$HOME/.cargo/bin:$PATH; fi - if [ -z "$NOHACK" ]; then curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-${HOST:-$TARGET}.tar.gz | tar xzf - -C ~/.cargo/bin; fi - - if [ -z "$NOHACK" ]; then $TOOL +$TOOLCHAIN hack $ZFLAGS check --target $TARGET --each-feature; fi + - if [ -z "$NOHACK" ]; then $TOOL hack $ZFLAGS check --target $TARGET --each-feature; fi # Tests that do require executing the binaries test: &TEST << : *BUILD test_script: - . $HOME/.cargo/env || true - - $TOOL +$TOOLCHAIN test --target $TARGET + - $TOOL test --target $TARGET # Test FreeBSD in a full VM. Test the i686 target too, in the # same VM. The binary will be built in 32-bit mode, but will execute on a @@ -52,10 +51,10 @@ task: setup_script: - kldload mqueuefs - fetch https://sh.rustup.rs -o rustup.sh - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *TEST i386_test_script: - . $HOME/.cargo/env @@ -76,9 +75,9 @@ task: image: ghcr.io/cirruslabs/macos-ventura-base:latest setup_script: - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index @@ -129,7 +128,7 @@ task: setup_script: - mkdir /tmp/home - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain $MSRV - . $HOME/.cargo/env - cargo install cross --version 0.2.1 # cross 0.2.2 bumped the MSRV to 1.58.1 << : *TEST @@ -165,9 +164,7 @@ task: image: rust:latest env: TARGET: x86_64-unknown-linux-gnu - TOOLCHAIN: setup_script: - - rustup target add $TARGET - rustup component add clippy << : *TEST before_cache_script: rm -rf $CARGO_HOME/registry/index @@ -242,37 +239,33 @@ task: TARGET: x86_64-unknown-netbsd setup_script: - rustup target add $TARGET - - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index task: container: - image: rust:1.63.0 + # Redox's MSRV policy is unclear. Until they define it, use nightly. + image: rustlang/rust:nightly env: BUILD: check name: Redox x86_64 env: HOST: x86_64-unknown-linux-gnu TARGET: x86_64-unknown-redox - # Redox's MSRV policy is unclear. Until they define it, use nightly. - TOOLCHAIN: nightly setup_script: - rustup target add $TARGET - - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET - - rustup component add --toolchain $TOOLCHAIN clippy + - rustup component add clippy << : *BUILD before_cache_script: rm -rf $CARGO_HOME/registry/index -# Rust Tier 3 targets can't use Rustup +## Rust Tier 3 targets can't use Rustup task: container: image: rustlang/rust:nightly env: BUILD: check HOST: x86_64-unknown-linux-gnu - TOOLCHAIN: nightly ZFLAGS: -Zbuild-std matrix: - name: DragonFly BSD x86_64 @@ -299,7 +292,6 @@ task: name: Minver env: HOST: x86_64-unknown-linux-gnu - TOOLCHAIN: nightly container: image: rustlang/rust:nightly setup_script: @@ -313,5 +305,5 @@ task: name: Rust Formatter container: image: rust:latest - setup_script: rustup +$TOOLCHAIN component add rustfmt - test_script: $TOOL +$TOOLCHAIN fmt --all -- --check **/*.rs + setup_script: rustup component add rustfmt + test_script: cargo fmt --all -- --check **/*.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b5dad1..beebcdb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Added `LocalPeerPid` to `nix::sys::socket::sockopt` for macOS. ([#1967](https://github.com/nix-rust/nix/pull/1967)) - Added `TFD_TIMER_CANCEL_ON_SET` to `::nix::sys::time::TimerSetTimeFlags` on Linux and Android. ([#2040](https://github.com/nix-rust/nix/pull/2040)) +- Added `SOF_TIMESTAMPING_OPT_ID` and `SOF_TIMESTAMPING_OPT_TSONLY` to `nix::sys::socket::TimestampingFlag`. + ([#2048](https://github.com/nix-rust/nix/pull/2048)) ### Changed @@ -36,12 +38,15 @@ This project adheres to [Semantic Versioning](https://semver.org/). ([#2012](https://github.com/nix-rust/nix/pull/2012)) ### Fixed -- Fix `SockaddrIn6` bug that was swapping flowinfo and scope_id byte ordering. - ([#1964](https://github.com/nix-rust/nix/pull/1964)) -- Fix: send ETH_P_ALL in htons format +- Fix: send `ETH_P_ALL` in htons format ([#1925](https://github.com/nix-rust/nix/pull/1925)) - Fix: `recvmsg` now sets the length of the received `sockaddr_un` field correctly on Linux platforms. ([#2041](https://github.com/nix-rust/nix/pull/2041)) +- Fix potentially invalid conversions in + `SockaddrIn::from<std::net::SocketAddrV4>`, + `SockaddrIn6::from<std::net::SockaddrV6>`, `IpMembershipRequest::new`, and + `Ipv6MembershipRequest::new` with future Rust versions. + ([#2061](https://github.com/nix-rust/nix/pull/2061)) ### Removed @@ -53,6 +58,14 @@ This project adheres to [Semantic Versioning](https://semver.org/). `nix::sys::signalfd::SignalFd` instead. ([#1938](https://github.com/nix-rust/nix/pull/1938)) +## [0.26.2] - 2023-01-18 + +### Fixed + +- Fix `SockaddrIn6` bug that was swapping `flowinfo` and `scope_id` byte + ordering. + ([#1964](https://github.com/nix-rust/nix/pull/1964)) + ## [0.26.1] - 2022-11-29 ### Fixed - Fix UB with `sys::socket::sockopt::SockType` using `SOCK_PACKET`. @@ -28,10 +28,9 @@ targets = [ [dependencies] libc = { version = "0.2.141", features = ["extra_traits"] } -bitflags = "1.1" +bitflags = "2.3.1" cfg-if = "1.0" pin-utils = { version = "0.1.0", optional = true } -static_assertions = "1" memoffset = { version = "0.9", optional = true } [features] @@ -16,7 +16,7 @@ //! * `fs` - File system functionality //! * `hostname` - Get and set the system's hostname //! * `inotify` - Linux's `inotify` file system notification API -//! * `ioctl` - The `ioctl` syscall, and wrappers for my specific instances +//! * `ioctl` - The `ioctl` syscall, and wrappers for many specific instances //! * `kmod` - Load and unload kernel modules //! * `mman` - Stuff relating to memory management //! * `mount` - Mount and unmount file systems diff --git a/src/macros.rs b/src/macros.rs index 5d83a5ac..adff2bc6 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -63,6 +63,8 @@ macro_rules! libc_bitflags { } ) => { ::bitflags::bitflags! { + #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] + #[repr(transparent)] $(#[$outer])* pub struct $BitFlags: $T { $( diff --git a/src/mount/bsd.rs b/src/mount/bsd.rs index d124f1f9..6ed2dc7f 100644 --- a/src/mount/bsd.rs +++ b/src/mount/bsd.rs @@ -391,8 +391,8 @@ impl<'a> Nmount<'a> { }); let niov = self.iov.len() as c_uint; - let iovp = self.iov.as_mut_ptr() as *mut libc::iovec; - let res = unsafe { libc::nmount(iovp, niov, flags.bits) }; + let iovp = self.iov.as_mut_ptr(); + let res = unsafe { libc::nmount(iovp, niov, flags.bits()) }; match Errno::result(res) { Ok(_) => Ok(()), Err(error) => { @@ -446,7 +446,7 @@ where P: ?Sized + NixPath, { let res = mountpoint.with_nix_path(|cstr| unsafe { - libc::unmount(cstr.as_ptr(), flags.bits) + libc::unmount(cstr.as_ptr(), flags.bits()) })?; Errno::result(res).map(drop) diff --git a/src/mount/linux.rs b/src/mount/linux.rs index 5f19a5f1..e9876037 100644 --- a/src/mount/linux.rs +++ b/src/mount/linux.rs @@ -132,7 +132,7 @@ pub fn mount< s, t.as_ptr(), ty, - flags.bits, + flags.bits(), d as *const libc::c_void, ) }) @@ -156,7 +156,7 @@ pub fn umount<P: ?Sized + NixPath>(target: &P) -> Result<()> { /// See also [`umount`](https://man7.org/linux/man-pages/man2/umount.2.html) pub fn umount2<P: ?Sized + NixPath>(target: &P, flags: MntFlags) -> Result<()> { let res = target.with_nix_path(|cstr| unsafe { - libc::umount2(cstr.as_ptr(), flags.bits) + libc::umount2(cstr.as_ptr(), flags.bits()) })?; Errno::result(res).map(drop) diff --git a/src/mqueue.rs b/src/mqueue.rs index ac183eb5..7ce7d5e8 100644 --- a/src/mqueue.rs +++ b/src/mqueue.rs @@ -139,7 +139,7 @@ impl MqAttr { /// Open a message queue /// /// See also [`mq_open(2)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_open.html) -// The mode.bits cast is only lossless on some OSes +// The mode.bits() cast is only lossless on some OSes #[allow(clippy::cast_lossless)] pub fn mq_open( name: &CStr, diff --git a/src/sys/event.rs b/src/sys/event.rs index 5dcf121a..ec7f7e27 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -71,7 +71,7 @@ impl Kqueue { timeout as *const timespec } else { ptr::null() - } + }, ) }; Errno::result(res).map(|r| r as usize) @@ -86,7 +86,7 @@ impl Kqueue { target_os = "openbsd" ))] type type_of_udata = *mut libc::c_void; -#[cfg(any(target_os = "netbsd"))] +#[cfg(target_os = "netbsd")] type type_of_udata = intptr_t; #[cfg(target_os = "netbsd")] @@ -171,7 +171,7 @@ libc_enum! { ))] #[doc(hidden)] pub type type_of_event_flag = u16; -#[cfg(any(target_os = "netbsd"))] +#[cfg(target_os = "netbsd")] #[doc(hidden)] pub type type_of_event_flag = u32; libc_bitflags! { diff --git a/src/sys/personality.rs b/src/sys/personality.rs index f295a05f..30231dd7 100644 --- a/src/sys/personality.rs +++ b/src/sys/personality.rs @@ -80,7 +80,10 @@ pub fn get() -> Result<Persona> { /// /// Example: /// -/// ``` +// Disable test on aarch64 until we know why it fails. +// https://github.com/nix-rust/nix/issues/2060 +#[cfg_attr(target_arch = "aarch64", doc = " ```no_run")] +#[cfg_attr(not(target_arch = "aarch64"), doc = " ```")] /// # use nix::sys::personality::{self, Persona}; /// let mut pers = personality::get().unwrap(); /// assert!(!pers.contains(Persona::ADDR_NO_RANDOMIZE)); diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 88bd6f5a..0517615e 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -39,18 +39,17 @@ use std::{fmt, mem, net, ptr, slice}; /// Convert a std::net::Ipv4Addr into the libc form. #[cfg(feature = "net")] pub(crate) const fn ipv4addr_to_libc(addr: net::Ipv4Addr) -> libc::in_addr { - static_assertions::assert_eq_size!(net::Ipv4Addr, libc::in_addr); - // Safe because both types have the same memory layout, and no fancy Drop - // impls. - unsafe { mem::transmute(addr) } + libc::in_addr { + s_addr: u32::from_ne_bytes(addr.octets()) + } } /// Convert a std::net::Ipv6Addr into the libc form. #[cfg(feature = "net")] pub(crate) const fn ipv6addr_to_libc(addr: &net::Ipv6Addr) -> libc::in6_addr { - static_assertions::assert_eq_size!(net::Ipv6Addr, libc::in6_addr); - // Safe because both are Newtype wrappers around the same libc type - unsafe { mem::transmute(*addr) } + libc::in6_addr { + s6_addr: addr.octets() + } } /// These constants specify the protocol family to be used @@ -485,6 +484,7 @@ enum UnixAddrKind<'a> { } impl<'a> UnixAddrKind<'a> { /// Safety: sun & sun_len must be valid + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms unsafe fn get(sun: &'a libc::sockaddr_un, sun_len: u8) -> Self { assert!(sun_len as usize >= offset_of!(libc::sockaddr_un, sun_path)); let path_len = @@ -521,6 +521,7 @@ impl<'a> UnixAddrKind<'a> { impl UnixAddr { /// Create a new sockaddr_un representing a filesystem path. + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms pub fn new<P: ?Sized + NixPath>(path: &P) -> Result<UnixAddr> { path.with_nix_path(|cstr| unsafe { let mut ret = libc::sockaddr_un { @@ -568,6 +569,7 @@ impl UnixAddr { /// processes to communicate with processes having a different filesystem view. #[cfg(any(target_os = "android", target_os = "linux"))] #[cfg_attr(docsrs, doc(cfg(all())))] + #[allow(clippy::unnecessary_cast)] // Not unnecessary on all platforms pub fn new_abstract(path: &[u8]) -> Result<UnixAddr> { unsafe { let mut ret = libc::sockaddr_un { @@ -990,9 +992,6 @@ impl SockaddrLike for () { } /// An IPv4 socket address -// This is identical to net::SocketAddrV4. But the standard library -// doesn't allow direct access to the libc fields, which we need. So we -// reimplement it here. #[cfg(feature = "net")] #[repr(transparent)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 4ca12997..3abcb033 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -247,14 +247,18 @@ libc_bitflags! { SOF_TIMESTAMPING_SOFTWARE; /// Report hardware timestamps as generated by SOF_TIMESTAMPING_TX_HARDWARE when available. SOF_TIMESTAMPING_RAW_HARDWARE; - /// Collect transmiting timestamps as reported by hardware + /// Collect transmitting timestamps as reported by hardware SOF_TIMESTAMPING_TX_HARDWARE; - /// Collect transmiting timestamps as reported by software + /// Collect transmitting timestamps as reported by software SOF_TIMESTAMPING_TX_SOFTWARE; /// Collect receiving timestamps as reported by hardware SOF_TIMESTAMPING_RX_HARDWARE; /// Collect receiving timestamps as reported by software SOF_TIMESTAMPING_RX_SOFTWARE; + /// Generate a unique identifier along with each transmitted packet + SOF_TIMESTAMPING_OPT_ID; + /// Return transmit timestamps alongside an empty packet instead of the original packet + SOF_TIMESTAMPING_OPT_TSONLY; } } @@ -2239,7 +2243,7 @@ pub fn recvfrom<T: SockaddrLike>( Ok(( ret, T::from_raw( - addr.assume_init().as_ptr() as *const sockaddr, + addr.assume_init().as_ptr(), Some(len), ), )) diff --git a/src/sys/stat.rs b/src/sys/stat.rs index 78203bfb..7e51c03a 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -177,7 +177,7 @@ pub fn mknod<P: ?Sized + NixPath>( dev: dev_t, ) -> Result<()> { let res = path.with_nix_path(|cstr| unsafe { - libc::mknod(cstr.as_ptr(), kind.bits | perm.bits() as mode_t, dev) + libc::mknod(cstr.as_ptr(), kind.bits() | perm.bits() as mode_t, dev) })?; Errno::result(res).map(drop) @@ -202,7 +202,7 @@ pub fn mknodat<P: ?Sized + NixPath>( libc::mknodat( dirfd, cstr.as_ptr(), - kind.bits | perm.bits() as mode_t, + kind.bits() | perm.bits() as mode_t, dev, ) })?; diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs index c2c86624..35424e5e 100644 --- a/src/sys/statvfs.rs +++ b/src/sys/statvfs.rs @@ -12,7 +12,6 @@ use crate::{errno::Errno, NixPath, Result}; #[cfg(not(target_os = "redox"))] libc_bitflags!( /// File system mount Flags - #[repr(C)] #[derive(Default)] pub struct FsFlags: c_ulong { /// Read Only diff --git a/src/sys/termios.rs b/src/sys/termios.rs index b0286f51..af29d64d 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -309,7 +309,7 @@ impl Termios { let termios = *self.inner.borrow_mut(); self.input_flags = InputFlags::from_bits_truncate(termios.c_iflag); self.output_flags = OutputFlags::from_bits_truncate(termios.c_oflag); - self.control_flags = ControlFlags::from_bits_truncate(termios.c_cflag); + self.control_flags = ControlFlags::from_bits_retain(termios.c_cflag); self.local_flags = LocalFlags::from_bits_truncate(termios.c_lflag); self.control_chars = termios.c_cc; #[cfg(any( @@ -355,9 +355,9 @@ libc_enum! { /// enum. /// /// B0 is special and will disable the port. - #[cfg_attr(all(any(target_os = "haiku"), target_pointer_width = "64"), repr(u8))] + #[cfg_attr(target_os = "haiku", repr(u8))] #[cfg_attr(all(any(target_os = "ios", target_os = "macos"), target_pointer_width = "64"), repr(u64))] - #[cfg_attr(not(all(any(target_os = "ios", target_os = "macos", target_os = "haiku"), target_pointer_width = "64")), repr(u32))] + #[cfg_attr(all(not(all(any(target_os = "ios", target_os = "macos"), target_pointer_width = "64")), not(target_os = "haiku")), repr(u32))] #[non_exhaustive] pub enum BaudRate { B0, diff --git a/src/sys/time.rs b/src/sys/time.rs index 30ee5fd1..a0160e21 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -91,6 +91,7 @@ pub(crate) mod timer { #[cfg(any(target_os = "android", target_os = "linux"))] bitflags! { /// Flags that are used for arming the timer. + #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct TimerSetTimeFlags: libc::c_int { const TFD_TIMER_ABSTIME = libc::TFD_TIMER_ABSTIME; const TFD_TIMER_CANCEL_ON_SET = libc::TFD_TIMER_CANCEL_ON_SET; @@ -104,6 +105,7 @@ pub(crate) mod timer { ))] bitflags! { /// Flags that are used for arming the timer. + #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct TimerSetTimeFlags: libc::c_int { const TFD_TIMER_ABSTIME = libc::TIMER_ABSTIME; } diff --git a/src/unistd.rs b/src/unistd.rs index 7230c337..afa80e9b 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -3375,7 +3375,7 @@ feature! { /// See [access(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html) pub fn access<P: ?Sized + NixPath>(path: &P, amode: AccessFlags) -> Result<()> { let res = path.with_nix_path(|cstr| unsafe { - libc::access(cstr.as_ptr(), amode.bits) + libc::access(cstr.as_ptr(), amode.bits()) })?; Errno::result(res).map(drop) } @@ -3422,7 +3422,7 @@ pub fn faccessat<P: ?Sized + NixPath>( ))] pub fn eaccess<P: ?Sized + NixPath>(path: &P, mode: AccessFlags) -> Result<()> { let res = path.with_nix_path(|cstr| unsafe { - libc::eaccess(cstr.as_ptr(), mode.bits) + libc::eaccess(cstr.as_ptr(), mode.bits()) })?; Errno::result(res).map(drop) } diff --git a/test/sys/test_socket.rs b/test/sys/test_socket.rs index 125edceb..ad7b457e 100644 --- a/test/sys/test_socket.rs +++ b/test/sys/test_socket.rs @@ -10,7 +10,7 @@ use std::path::Path; use std::slice; use std::str::FromStr; -#[cfg(any(target_os = "linux"))] +#[cfg(target_os = "linux")] #[cfg_attr(qemu, ignore)] #[test] pub fn test_timestamping() { @@ -2125,7 +2125,7 @@ pub fn test_vsock() { // Disable the test on emulated platforms because it fails in Cirrus-CI. Lack // of QEMU support is suspected. #[cfg_attr(qemu, ignore)] -#[cfg(all(target_os = "linux"))] +#[cfg(target_os = "linux")] #[test] fn test_recvmsg_timestampns() { use nix::sys::socket::*; @@ -2180,7 +2180,7 @@ fn test_recvmsg_timestampns() { // Disable the test on emulated platforms because it fails in Cirrus-CI. Lack // of QEMU support is suspected. #[cfg_attr(qemu, ignore)] -#[cfg(all(target_os = "linux"))] +#[cfg(target_os = "linux")] #[test] fn test_recvmmsg_timestampns() { use nix::sys::socket::*; diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index de502d1a..31df6d03 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -340,7 +340,7 @@ mod linux_android { let buf1 = b"abcdef"; let buf2 = b"defghi"; - let iovecs = vec![IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])]; + let iovecs = [IoSlice::new(&buf1[0..3]), IoSlice::new(&buf2[0..3])]; let res = vmsplice(wr, &iovecs[..], SpliceFFlags::empty()).unwrap(); diff --git a/test/test_sendfile.rs b/test/test_sendfile.rs index c6ac6e6f..b85e030f 100644 --- a/test/test_sendfile.rs +++ b/test/test_sendfile.rs @@ -72,10 +72,10 @@ fn test_sendfile64_linux() { fn test_sendfile_freebsd() { // Declare the content let header_strings = - vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; + ["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; let body = "Xabcdef123456"; let body_offset = 1; - let trailer_strings = vec!["\n", "Served by Make Believe\n"]; + let trailer_strings = ["\n", "Served by Make Believe\n"]; // Write the body to a file let mut tmp = tempfile().unwrap(); @@ -123,10 +123,10 @@ fn test_sendfile_freebsd() { fn test_sendfile_dragonfly() { // Declare the content let header_strings = - vec!["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; + ["HTTP/1.1 200 OK\n", "Content-Type: text/plain\n", "\n"]; let body = "Xabcdef123456"; let body_offset = 1; - let trailer_strings = vec!["\n", "Served by Make Believe\n"]; + let trailer_strings = ["\n", "Served by Make Believe\n"]; // Write the body to a file let mut tmp = tempfile().unwrap(); |