Skip to content

Commit 72cfa2f

Browse files
authored
Merge pull request #337 from cea-sec/dependabot/cargo/nix-0.28.0
build(deps): bump nix from 0.27.1 to 0.28.0
2 parents 32ef1cc + 60fada0 commit 72cfa2f

File tree

6 files changed

+30
-26
lines changed

6 files changed

+30
-26
lines changed

Cargo.lock

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

usbsas-comm/src/lib.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use std::{
99
fs::File,
1010
io::{self, Read, Write},
1111
marker::PhantomData,
12-
os::unix::io::{AsRawFd, FromRawFd, RawFd},
12+
os::{
13+
fd::OwnedFd,
14+
unix::io::{AsRawFd, FromRawFd, RawFd},
15+
},
1316
str::FromStr,
1417
};
1518
use usbsas_utils::{INPUT_PIPE_FD_VAR, OUTPUT_PIPE_FD_VAR};
@@ -72,16 +75,10 @@ impl<R> Comm<R> {
7275
})
7376
}
7477

75-
pub fn from_raw_fd(read: RawFd, write: RawFd) -> Self {
76-
let output;
77-
let input;
78-
unsafe {
79-
input = File::from_raw_fd(read);
80-
output = File::from_raw_fd(write);
81-
}
78+
pub fn from_fd(read: OwnedFd, write: OwnedFd) -> Self {
8279
Comm {
83-
input,
84-
output,
80+
input: File::from(read),
81+
output: File::from(write),
8582
req: PhantomData,
8683
}
8784
}

usbsas-process/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "GPL-3.0"
77
[dependencies]
88
libc = "0.2"
99
log = "0.4"
10-
nix = { version = "0.27", features = ["fs", "process"] }
10+
nix = { version = "0.28", features = ["fs", "process"] }
1111
thiserror = "1.0"
1212
usbsas-comm = { path = "../usbsas-comm" }
1313
usbsas-utils = { path = "../usbsas-utils" }

usbsas-process/src/lib.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use nix::{
77
};
88
use std::{
99
io::{self, Write},
10-
os::unix::io::RawFd,
10+
os::unix::io::{AsRawFd, RawFd},
1111
path, process,
1212
};
1313
use thiserror::Error;
@@ -88,12 +88,18 @@ impl<'a> UsbsasChildSpawner<'a> {
8888

8989
let (child_to_parent_rd, child_to_parent_wr) = unistd::pipe()?;
9090
let (parent_to_child_rd, parent_to_child_wr) = unistd::pipe()?;
91-
set_cloexec(child_to_parent_rd)?;
92-
set_cloexec(parent_to_child_wr)?;
91+
set_cloexec(child_to_parent_rd.as_raw_fd())?;
92+
set_cloexec(parent_to_child_wr.as_raw_fd())?;
9393

9494
command.env_clear();
95-
command.env(INPUT_PIPE_FD_VAR, parent_to_child_rd.to_string());
96-
command.env(OUTPUT_PIPE_FD_VAR, child_to_parent_wr.to_string());
95+
command.env(
96+
INPUT_PIPE_FD_VAR,
97+
parent_to_child_rd.as_raw_fd().to_string(),
98+
);
99+
command.env(
100+
OUTPUT_PIPE_FD_VAR,
101+
child_to_parent_wr.as_raw_fd().to_string(),
102+
);
97103
DEFAULT_ENV_VARS
98104
.iter()
99105
.map(|k| std::env::var(k).map(|v| (k, v)))
@@ -104,12 +110,12 @@ impl<'a> UsbsasChildSpawner<'a> {
104110

105111
let child = command.spawn()?;
106112

107-
unistd::close(parent_to_child_rd)?;
108-
unistd::close(child_to_parent_wr)?;
113+
drop(parent_to_child_rd);
114+
drop(child_to_parent_wr);
109115

110116
Ok(UsbsasChild {
111117
child,
112-
comm: Comm::from_raw_fd(child_to_parent_rd, parent_to_child_wr),
118+
comm: Comm::from_fd(child_to_parent_rd, parent_to_child_wr),
113119
locked: self.wait_on_startup,
114120
})
115121
}

usbsas-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ futures = "0.3"
1515
hmac = { version = "0.12", features = ["reset"] }
1616
log = "0.4"
1717
mac_address = "1.1"
18-
nix = { version = "0.27", features = ["process", "signal"] }
18+
nix = { version = "0.28", features = ["process", "signal"] }
1919
rand = "0.8"
2020
serde = { version = "1.0", features = ["derive"] }
2121
serde_json = "1.0"

usbsas-tools/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fuse_mt = { version = "0.6", optional = true }
1313
indicatif = { version = "0.17", optional = true }
1414
libc = { version = "0.2", optional = true }
1515
log = "0.4"
16-
nix = { version = "0.27", optional = true, features = ["user"] }
16+
nix = { version = "0.28", optional = true, features = ["user"] }
1717
tempfile = { version = "3.10", optional = true }
1818
serde_json = { version = "1.0", optional = true}
1919
thiserror = "1.0"

0 commit comments

Comments
 (0)