Skip to content

Commit

Permalink
Merge pull request #46 from cgwalters/bump-nix
Browse files Browse the repository at this point in the history
Bump to nix 0.26
  • Loading branch information
jmarrero committed May 1, 2023
2 parents aaaaaad + 8a54eb3 commit 09cfcb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ anyhow = "1.0"
capctl = "0.2.0"
fn-error-context = "0.2.0"
futures-util = "0.3.13"
nix = "0.23.0"
nix = "0.26"
oci-spec = "0.5.5"
once_cell = "1.9.0"
libc = "0.2"
Expand Down
12 changes: 6 additions & 6 deletions src/imageproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use cap_std_ext::cap_std;
use cap_std_ext::prelude::CapStdExtCommandExt;
use futures_util::Future;
use nix::sys::socket::{self as nixsocket, ControlMessageOwned};
use nix::sys::uio::IoVec;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::fs::File;
Expand Down Expand Up @@ -309,22 +308,23 @@ impl ImageProxy {
drop(sendbuf);
let mut buf = [0u8; MAX_MSG_SIZE];
let mut cmsg_buffer = nix::cmsg_space!([RawFd; 1]);
let iov = IoVec::from_mut_slice(buf.as_mut());
let r = nixsocket::recvmsg(
let iov = std::io::IoSliceMut::new(buf.as_mut());
let r = nixsocket::recvmsg::<()>(
sockfd.as_raw_fd(),
&[iov],
&mut [iov],
Some(&mut cmsg_buffer),
nixsocket::MsgFlags::MSG_CMSG_CLOEXEC,
)?;
let buf = &buf[0..r.bytes];
// SAFETY: We provided a buffer
let iov = r.iovs().next().unwrap();
let mut fdret: Option<File> = None;
for cmsg in r.cmsgs() {
if let Some(f) = file_from_scm_rights(cmsg) {
fdret = Some(f);
break;
}
}
let reply: Reply = serde_json::from_slice(buf).context("Deserializing reply")?;
let reply: Reply = serde_json::from_slice(iov).context("Deserializing reply")?;
if !reply.success {
return Err(anyhow!("remote error: {}", reply.error));
}
Expand Down

0 comments on commit 09cfcb3

Please sign in to comment.