Skip to content

Commit

Permalink
Revert use of map_or, restoring compatibility with pre-1.41 rustc
Browse files Browse the repository at this point in the history
  • Loading branch information
SolraBizna committed May 8, 2020
1 parent d559aed commit 6fdd54d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ fn inner_readlink<P: ?Sized + NixPath>(dirfd: Option<RawFd>, path: &P)
}
// Uh oh, the result is too long...
// Let's try to ask lstat how many bytes to allocate.
let reported_size = super::sys::stat::lstat(path).map_or(0, |x| x.st_size);
let reported_size = super::sys::stat::lstat(path)
.and_then(|x| Ok(x.st_size)).unwrap_or(0);
let mut try_size = if reported_size > 0 {
// Note: even if `lstat`'s apparently valid answer turns out to be
// wrong, we will still read the full symlink no matter what.
Expand Down

0 comments on commit 6fdd54d

Please sign in to comment.