mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
exclusive lock on cookie file
This commit is contained in:
committed by
Aiden McClelland
parent
6c91d3b7af
commit
0517e2d4e8
@@ -41,7 +41,11 @@ pub struct CliContextSeed {
|
||||
impl Drop for CliContextSeed {
|
||||
fn drop(&mut self) {
|
||||
let tmp = format!("{}.tmp", self.cookie_path.display());
|
||||
let mut writer = File::create(&tmp).unwrap();
|
||||
let mut writer = fd_lock_rs::FdLock::lock(
|
||||
File::create(&tmp).unwrap(),
|
||||
fd_lock_rs::LockType::Exclusive,
|
||||
true,
|
||||
);
|
||||
let store = self.cookie_store.lock().unwrap();
|
||||
store.save_json(&mut writer).unwrap();
|
||||
writer.sync_all().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user