From 47f23f518e9b935943b5e71ccd0cbc978aff433f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 17 Jul 2020 02:55:20 -0400 Subject: fix a misconception in a comment --- src/command.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/command.rs b/src/command.rs index f7b1de8..3c46739 100644 --- a/src/command.rs +++ b/src/command.rs @@ -35,11 +35,9 @@ impl Command for std::process::Command { .stdout(unsafe { std::process::Stdio::from_raw_fd(stdout) }) .stderr(unsafe { std::process::Stdio::from_raw_fd(stderr) }); - // XXX not entirely safe - setsid() and close() are async-signal-safe - // functions, but ioctl() is not, and only async-signal-safe functions - // are allowed to be called between fork() and exec(). other things - // seem to be able to get away with this though, so i'm not sure what - // the right answer here is? + // safe because setsid() and close() are async-signal-safe functions + // and ioctl() is a raw syscall (which is inherently + // async-signal-safe). unsafe { self.pre_exec(move || { nix::unistd::setsid().map_err(|e| e.as_errno().unwrap())?; -- cgit v1.2.3