Skip to content

Commit

Permalink
Use cap-std's new read_link_contents function.
Browse files Browse the repository at this point in the history
The read_link function refuses to return the value of a symlink if it's
absolute.
  • Loading branch information
asomers committed May 28, 2024
1 parent 309ef5e commit 2ae1ec8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ tokio = { version = "1.37.0", features = ["macros", "rt-multi-thread"] }
unftp-sbe-fs = { path = "../libunftp/crates/unftp-sbe-fs" }

[patch.crates-io]
cap-std = { git = "https://github.com/asomers/cap-std", rev = "73bc997" }
capsicum = { git = "https://github.com/asomers/capsicum-rs", rev = "24330ee"}
casper-sys = { git = "https://github.com/asomers/capsicum-rs", rev = "24330ee"}

Expand Down
2 changes: 1 addition & 1 deletion crates/unftp-sbe-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ readme = "README.md"
[dependencies]
async-trait = "0.1.80"
cfg-if = "1.0"
cap-std = "3.0"
cap-std = "3.1"
futures = { version = "0.3.30", default-features = false, features = ["std"] }
lazy_static = "1.4.0"
libunftp = { version = "0.20.0", path = "../../" }
Expand Down
4 changes: 2 additions & 2 deletions crates/unftp-sbe-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<User: UserDetail> StorageBackend<User> for Filesystem {
.await
.map_err(|_| Error::from(ErrorKind::PermanentFileNotAvailable))?;
let target = if fs_meta.is_symlink() {
match self.root_fd.read_link(path) {
match self.root_fd.read_link_contents(path) {
Ok(p) => Some(p),
Err(_e) => {
// XXX We should really log an error here. But a logger object is not
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<User: UserDetail> StorageBackend<User> for Filesystem {
let fullpath = path.join(entry_path.clone());
cap_fs::symlink_metadata(self.root_fd.clone(), fullpath.clone()).map_ok(move |meta| {
let target = if meta.is_symlink() {
match self.root_fd.read_link(&fullpath) {
match self.root_fd.read_link_contents(&fullpath) {
Ok(p) => Some(p),
Err(_e) => {
// XXX We should really log an error here. But a logger object is
Expand Down

0 comments on commit 2ae1ec8

Please sign in to comment.