diff --git a/src/encrypted_fs.rs b/src/encrypted_fs.rs index 21cd58cf..ca346e07 100644 --- a/src/encrypted_fs.rs +++ b/src/encrypted_fs.rs @@ -15,7 +15,7 @@ use rand::{OsRng, Rng}; use serde::{Deserialize, Serialize}; use strum_macros::{Display, EnumIter, EnumString}; use thiserror::Error; -use tracing::{debug, error}; +use tracing::error; #[cfg(test)] mod encrypted_fs_tests; @@ -137,6 +137,7 @@ struct TimeAndSizeFileAttr { } impl TimeAndSizeFileAttr { + #[allow(dead_code)] fn new(ino: u64, atime: SystemTime, mtime: SystemTime, ctime: SystemTime, crtime: SystemTime, size: u64) -> Self { Self { ino, @@ -696,7 +697,7 @@ impl EncryptedFs { // when we release the handle we will move this tmp file to the actual file // remove handle data because we will replace it with the tmp one - let (attr, path, mut position, encryptor) = + let (attr, path, _, encryptor) = self.write_handles.remove(&handle).unwrap(); // finish the current writer so we flush all data to the file @@ -719,7 +720,7 @@ impl EncryptedFs { let mut buffer: [u8; 4096] = [0; 4096]; let mut pos_read = 0; - position = 0; + let mut position = 0; if offset > 0 { loop { let offset_in_bounds = min(offset, attr.size); // keep offset in bounds of file diff --git a/src/encrypted_fs_fuse3.rs b/src/encrypted_fs_fuse3.rs index 279cbe50..afbf58f3 100644 --- a/src/encrypted_fs_fuse3.rs +++ b/src/encrypted_fs_fuse3.rs @@ -121,12 +121,12 @@ pub struct EncryptedFsFuse3 { impl EncryptedFsFuse3 { pub fn new(data_dir: &str, password: &str, cipher: Cipher, derive_key_hash_rounds: u32, - direct_io: bool, suid_support: bool) -> FsResult { + direct_io: bool, _suid_support: bool) -> FsResult { #[cfg(feature = "abi-7-26")] { Ok(Self { fs: const_reentrant_mutex(RefCell::new(EncryptedFs::new(data_dir, password, cipher, derive_key_hash_rounds).unwrap())), direct_io, - suid_support, + suid_support: _suid_support, }) } #[cfg(not(feature = "abi-7-26"))] { diff --git a/src/main.rs b/src/main.rs index a9362bd2..2d4b4f60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,19 +3,17 @@ use std::backtrace::Backtrace; use std::ffi::OsStr; use std::io::Write; use std::str::FromStr; -use std::sync::Arc; -use std::sync::atomic::{AtomicBool, Ordering}; -use clap::{Arg, ArgAction, ArgMatches, Command, crate_version}; +use clap::{Arg, ArgAction, Command, crate_version}; use ctrlc::set_handler; use fuse3::MountOptions; use fuse3::raw::prelude::*; use rpassword::read_password; use strum::IntoEnumIterator; use tokio::task; -use tracing::{error, info, Level, warn}; +use tracing::{error, info, Level}; -use encrypted_fs::encrypted_fs::{EncryptedFs, Cipher}; +use encrypted_fs::encrypted_fs::{Cipher, EncryptedFs}; use encrypted_fs::encrypted_fs_fuse3::EncryptedFsFuse3; #[tokio::main] @@ -220,7 +218,12 @@ async fn run_fuse(mountpoint: String, data_dir: &str, password: &str, cipher: Ci let gid = unsafe { libc::getgid() }; let mut mount_options = MountOptions::default(); - mount_options.uid(uid).gid(gid).read_only(false); + mount_options + .uid(uid) + .gid(gid) + .read_only(false). + allow_root(allow_root). + allow_other(allow_other); let mount_path = OsStr::new(mountpoint.as_str()); Session::new(mount_options)