diff --git a/appmgr/src/context/cli.rs b/appmgr/src/context/cli.rs index 4f965cf6f..4519d27a5 100644 --- a/appmgr/src/context/cli.rs +++ b/appmgr/src/context/cli.rs @@ -41,9 +41,14 @@ 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, + ) + .unwrap(); let store = self.cookie_store.lock().unwrap(); - store.save_json(&mut writer).unwrap(); + store.save_json(&mut *writer).unwrap(); writer.sync_all().unwrap(); std::fs::rename(tmp, &self.cookie_path).unwrap(); } diff --git a/appmgr/src/db/mod.rs b/appmgr/src/db/mod.rs index 94c720b19..ac6fca35e 100644 --- a/appmgr/src/db/mod.rs +++ b/appmgr/src/db/mod.rs @@ -193,6 +193,6 @@ pub async fn ui( let ptr = "/ui".parse::()? + &pointer; Ok(WithRevision { response: (), - revision: Some(ctx.db.put(&ptr, &value, None).await?), + revision: ctx.db.put(&ptr, &value, None).await?, }) }