summaryrefslogtreecommitdiff
path: root/src/commands/mount.rs
diff options
context:
space:
mode:
authorkoverstreet <kent.overstreet@gmail.com>2024-05-30 20:41:29 -0400
committerGitHub <noreply@github.com>2024-05-30 20:41:29 -0400
commit96843fc95d50c270dc6903f30b57cc62a793daf9 (patch)
treedc1e36720101c0db36cfabcf2a06a2043cae1974 /src/commands/mount.rs
parentd42a09728051e3b3611fde927adf37c84589921c (diff)
parent781ea5d40ff40e2028868c9951c564d136fb24f9 (diff)
Merge pull request #283 from tmuehlbacher/msrv-and-tweaks
Msrv and tweaks
Diffstat (limited to 'src/commands/mount.rs')
-rw-r--r--src/commands/mount.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/commands/mount.rs b/src/commands/mount.rs
index 49849aae..622f6cb9 100644
--- a/src/commands/mount.rs
+++ b/src/commands/mount.rs
@@ -345,15 +345,15 @@ fn cmd_mount_inner(opt: Cli) -> Result<()> {
if unsafe { bcachefs::bch2_sb_is_encrypted(first_sb.sb) } {
let _key_handle = KeyHandle::new_from_search(&uuid).or_else(|_| {
opt.passphrase_file
- .map(|path| {
- Passphrase::new_from_file(&first_sb, path)
- .inspect_err(|e| {
- error!(
- "Failed to read passphrase from file, falling back to prompt: {}",
- e
- )
- })
- .and_then(|p| KeyHandle::new(&first_sb, &p))
+ .and_then(|path| match Passphrase::new_from_file(&first_sb, path) {
+ Ok(p) => Some(KeyHandle::new(&first_sb, &p)),
+ Err(e) => {
+ error!(
+ "Failed to read passphrase from file, falling back to prompt: {}",
+ e
+ );
+ None
+ }
})
.unwrap_or_else(|| opt.unlock_policy.apply(&first_sb))
});