From 0aa87c1f53fd025fa7c26a7bc64f6befb51b42ec Mon Sep 17 00:00:00 2001 From: oupson Date: Sun, 9 Oct 2022 12:43:26 +0200 Subject: [PATCH] Change error message and info for user --- rustcryptfs-fuse/src/encrypted_filesystem.rs | 6 +++--- rustcryptfs/src/main.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rustcryptfs-fuse/src/encrypted_filesystem.rs b/rustcryptfs-fuse/src/encrypted_filesystem.rs index 1ada739..7f5f5e1 100644 --- a/rustcryptfs-fuse/src/encrypted_filesystem.rs +++ b/rustcryptfs-fuse/src/encrypted_filesystem.rs @@ -47,7 +47,7 @@ impl EncryptedFs { log::info!("Opening dir ..."); let fs = GocryptFs::open(path, password)?; - log::info!("Done"); + println!("Filesystem mounted and ready."); let mut inode_cache = BTreeMap::new(); inode_cache.insert(FUSE_ROOT_ID, path.to_path_buf()); @@ -307,7 +307,7 @@ impl Filesystem for EncryptedFs { match self.lookup_impl(parent, name) { Ok((ttl, attr, generation)) => reply.entry(&ttl, &attr, generation), Err(e) => { - log::error!("lookup : {}", e); + log::debug!("error on lookup : {}", e); reply.error(e.to_raw_code()) } } @@ -324,7 +324,7 @@ impl Filesystem for EncryptedFs { match self.read_dir_impl(ino, offset, &mut reply) { Ok(()) => reply.ok(), Err(e) => { - log::error!("readdir : {}", e); + log::debug!("error on readdir : {}", e); reply.error(e.to_raw_code()) } } diff --git a/rustcryptfs/src/main.rs b/rustcryptfs/src/main.rs index 2b99749..2e70937 100644 --- a/rustcryptfs/src/main.rs +++ b/rustcryptfs/src/main.rs @@ -51,7 +51,7 @@ fn ls(c: &LsCommand) -> anyhow::Result<()> { for dir in std::fs::read_dir(folder_path)?.flat_map(|e| e.ok()) { let filename = dir.file_name(); - let filename = filename.to_str().unwrap(); + let filename = filename.to_string_lossy(); if filename != "gocryptfs.conf" && filename != "gocryptfs.diriv" { if filename.starts_with("gocryptfs.longname.") { @@ -62,7 +62,7 @@ fn ls(c: &LsCommand) -> anyhow::Result<()> { println!("{}", res); } } - } else if let Ok(res) = dir_decoder.decode_filename(filename) { + } else if let Ok(res) = dir_decoder.decode_filename(&*filename) { println!("{}", res); } } @@ -88,7 +88,7 @@ fn decrypt_file(c: &DecryptCommand) -> anyhow::Result<()> { &password, )?; - let mut file = File::open(file_path).unwrap(); + let mut file = File::open(file_path)?; let enc = fs.content_decoder();