From cae5dda52c2b49b830bcdd9b4af4cb88ed90d608 Mon Sep 17 00:00:00 2001 From: Tim Bruijnzeels Date: Thu, 10 Dec 2020 15:58:46 +0100 Subject: [PATCH] Write notification.xml to new file, then rename #352 --- src/pubd/repository.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pubd/repository.rs b/src/pubd/repository.rs index 126457f8..2f5a8486 100644 --- a/src/pubd/repository.rs +++ b/src/pubd/repository.rs @@ -311,8 +311,10 @@ impl RrdpServer { } // something changed, update notification file + let notification_path_new = self.notification_path_new(); let notification_path = self.notification_path(); - self.notification.write_xml(¬ification_path)?; + self.notification.write_xml(¬ification_path_new)?; + fs::rename(notification_path_new, notification_path)?; // clean up under the base dir: // - old session dirs @@ -401,6 +403,12 @@ impl RrdpServer { // Cannot fail. Config checked at startup. } + fn notification_path_new(&self) -> PathBuf { + let mut path = self.rrdp_base_dir.clone(); + path.push("new-notification.xml"); + path + } + fn notification_path(&self) -> PathBuf { let mut path = self.rrdp_base_dir.clone(); path.push("notification.xml");