Skip to content

Commit

Permalink
Transfer ownership of FD
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant authored and mxpv committed Mar 12, 2024
1 parent d32d023 commit b15a1dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/shim/src/asynchronous/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use std::{
convert::TryFrom,
env,
os::unix::{fs::FileTypeExt, io::AsRawFd, net::UnixListener},
os::unix::{fs::FileTypeExt, net::UnixListener},
path::Path,
process,
process::{Command, Stdio},
Expand Down Expand Up @@ -285,7 +285,7 @@ pub async fn spawn(opts: StartOpts, grouping: &str, vars: Vec<(&str, &str)>) ->
&opts.address,
])
.fd_mappings(vec![FdMapping {
parent_fd: listener.as_raw_fd(),
parent_fd: listener.into(),
child_fd: SOCKET_FD,
}])?;
if opts.debug {
Expand All @@ -296,7 +296,6 @@ pub async fn spawn(opts: StartOpts, grouping: &str, vars: Vec<(&str, &str)>) ->
let _child = command.spawn().map_err(io_error!(e, "spawn shim"))?;
#[cfg(target_os = "linux")]
crate::cgroup::set_cgroup_and_oom_score(_child.id())?;
std::mem::forget(listener);
Ok(address)
}

Expand Down

0 comments on commit b15a1dd

Please sign in to comment.