From 8f589f7b88c20d4ed57708bcbde3e0cb3135ce81 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sun, 6 Apr 2025 17:13:26 +0200 Subject: [PATCH] Disable graphical debug only once writing to the fd This allows obtaining an fd for this before calling setrens while doing the actual disabling after calling it. --- src/scheme/debug.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/scheme/debug.rs b/src/scheme/debug.rs index e5ff0e0286..b5f965c40f 100644 --- a/src/scheme/debug.rs +++ b/src/scheme/debug.rs @@ -61,12 +61,7 @@ impl KernelScheme for DebugScheme { "no-preserve" => SpecialFds::NoPreserve as usize, - "disable-graphical-debug" => { - #[cfg(feature = "graphical_debug")] - graphical_debug::fini(); - - SpecialFds::DisableGraphicalDebug as usize - } + "disable-graphical-debug" => SpecialFds::DisableGraphicalDebug as usize, #[cfg(feature = "profiling")] p if p.starts_with("profiling-") => { @@ -165,6 +160,13 @@ impl KernelScheme for DebugScheme { return Ok(1); } + if handle.num == SpecialFds::DisableGraphicalDebug as usize { + #[cfg(feature = "graphical_debug")] + graphical_debug::fini(); + + return Ok(0); + } + if handle.num != SpecialFds::Default as usize && handle.num != SpecialFds::NoPreserve as usize {