diff --git a/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch b/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch new file mode 100644 index 0000000000..6b9a21d9c0 --- /dev/null +++ b/local/patches/base/P0-daemon-schemedaemon-option-unwrap.patch @@ -0,0 +1,33 @@ +diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs +index 9f507221..38752abc 100644 +--- a/daemon/src/lib.rs ++++ b/daemon/src/lib.rs +@@ -83,21 +83,25 @@ impl Daemon { + /// A long running background process that handles requests using schemes. + #[must_use = "SchemeDaemon::ready must be called"] + pub struct SchemeDaemon { +- write_pipe: PipeWriter, ++ write_pipe: Option, + } + + impl SchemeDaemon { + /// Create a new daemon for use with schemes. + pub fn new(f: impl FnOnce(SchemeDaemon) -> !) -> ! { +- let write_pipe = unsafe { io::PipeWriter::from_raw_fd(get_fd("INIT_NOTIFY")) }; ++ let write_pipe = unsafe { get_fd("INIT_NOTIFY").map(io::PipeWriter::from_raw_fd) }; + + f(SchemeDaemon { write_pipe }) + } + + /// Notify the process that the scheme daemon is ready to accept requests. + pub fn ready_with_fd(self, cap_fd: Fd) -> syscall::Result<()> { ++ let write_pipe = match self.write_pipe { ++ Some(pipe) => pipe, ++ None => return Ok(()), ++ }; + syscall::call_wo( +- self.write_pipe.as_raw_fd() as usize, ++ write_pipe.as_raw_fd() as usize, + &cap_fd.into_raw().to_ne_bytes(), + syscall::CallFlags::FD, + &[], diff --git a/recipes/core/base/recipe.toml b/recipes/core/base/recipe.toml index b11adee96f..749252c4c3 100644 --- a/recipes/core/base/recipe.toml +++ b/recipes/core/base/recipe.toml @@ -2,7 +2,7 @@ git = "https://gitlab.redox-os.org/redox-os/base.git" rev = "463f76b9608a896e6f6c9f63457f57f6409873c7" patches = [ - "P0-daemon-fix-init-notify-unwrap.patch", + "P0-daemon-schemedaemon-option-unwrap.patch", "P0-redox-scheme-bump-0.11.1.patch", "P0-workspace-add-bootstrap.patch", "P0-init-continuous-scheduling.patch",