From 85125a24fddd453fb0aa0b1099e93cf22175e92e Mon Sep 17 00:00:00 2001 From: Systemcluster Date: Tue, 23 Jul 2024 04:50:37 +0200 Subject: [PATCH] Prevent creation of more than one error file --- startpe/src/main.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/startpe/src/main.rs b/startpe/src/main.rs index 65d83fd..ef93e95 100644 --- a/startpe/src/main.rs +++ b/startpe/src/main.rs @@ -5,6 +5,7 @@ use std::{ mem::size_of, panic::set_hook, process::Command, + sync::atomic::{AtomicBool, Ordering}, time::SystemTime, }; @@ -53,6 +54,10 @@ fn main() { } #[cfg(windows)] { + static WRITTEN: AtomicBool = AtomicBool::new(false); + if WRITTEN.swap(true, Ordering::Relaxed) { + return; + } let now = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap_or_default();