From: Valentine Wallace Date: Wed, 17 Feb 2021 02:14:23 +0000 (-0500) Subject: print readonly X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=2870cde5901c6f6c18ad8a48d063ed94a569d428;p=rust-lightning print readonly --- diff --git a/lightning-persister/src/util.rs b/lightning-persister/src/util.rs index 681c28b07..e5fe0fba0 100644 --- a/lightning-persister/src/util.rs +++ b/lightning-persister/src/util.rs @@ -44,20 +44,20 @@ pub(crate) fn write_to_file(path: String, filename: String, da println!("VMW: created dir"); println!("VMW: entries in dir:"); - let mut dir_perms = fs::metadata(path.clone()).unwrap().permissions(); - println!("VMW: dir perms: {:?}", dir_perms); + let dir_perms = fs::metadata(path.clone()).unwrap().permissions(); + println!("VMW: dir perms: {:?}, readonly: {}", dir_perms, dir_perms.readonly()); let dir = PathBuf::from(path.clone()); for entry in fs::read_dir(dir).unwrap() { let entry = entry.unwrap(); let metadata = entry.metadata().unwrap(); - println!("VMW: entry in dir: {:?}, perms in entry: {:?}", entry.path(), metadata.permissions()); + println!("VMW: entry in dir: {:?}, perms in entry: {:?}, readonly: {}", entry.path(), metadata.permissions(), metadata.permissions().readonly()); } // Do a crazy dance with lots of fsync()s to be overly cautious here... // We never want to end up in a state where we've lost the old data, or end up using the // old data on power loss after we've returned. // The way to atomically write a file on Unix platforms is: // open(tmpname), write(tmpfile), fsync(tmpfile), close(tmpfile), rename(), fsync(dir) - let filename_with_path = get_full_filepath(path, filename); + let filename_with_path = get_full_filepath(path.clone(), filename); let tmp_filename = format!("{}.tmp", filename_with_path); {