From 954c68c0b15034eca977b677f063517bb005c575 Mon Sep 17 00:00:00 2001 From: Nahor Date: Thu, 21 May 2026 12:35:04 -0700 Subject: [PATCH] Fix comment typo (`CLO_EXEC` -> `CLOEXEC`) Closes #12774 --- src/exec.rs | 4 ++-- src/fd_monitor.rs | 2 +- src/fds.rs | 2 +- src/fork_exec/postfork.rs | 6 +++--- src/io.rs | 2 +- src/parser.rs | 2 +- src/redirection.rs | 2 +- src/universal_notifier/notifyd.rs | 6 +++--- tests/checks/fds.fish | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/exec.rs b/src/exec.rs index a78978bad..03af0b927 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -472,8 +472,8 @@ fn can_use_posix_spawn_for_job(job: &Job, dup2s: &Dup2List) -> bool { // For example if you were to write: // cmd 6< /dev/null // it is possible that the open() of /dev/null would result in fd 6. Here even if we attempted - // to add a dup2 action, it would be ignored and the CLO_EXEC bit would remain. So don't use - // posix_spawn in this case; instead we'll call fork() and clear the CLO_EXEC bit manually. + // to add a dup2 action, it would be ignored and the CLOEXEC bit would remain. So don't use + // posix_spawn in this case; instead we'll call fork() and clear the CLOEXEC bit manually. for action in dup2s.get_actions() { if action.src == action.target { return false; diff --git a/src/fd_monitor.rs b/src/fd_monitor.rs index ac0e83d39..7afbcc1e3 100644 --- a/src/fd_monitor.rs +++ b/src/fd_monitor.rs @@ -29,7 +29,7 @@ /// signal an event, making the fd readable. Multiple calls to `post()` may be coalesced. /// On Linux this uses eventfd, on other systems this uses a pipe. /// [`try_consume()`](FdEventSignaller::try_consume) may be used to consume the event. -/// Importantly this is async signal safe. Of course it is `CLO_EXEC` as well. +/// Importantly this is async signal safe. Of course it is `CLOEXEC` as well. pub struct FdEventSignaller { // Always the read end of the fd; maybe the write end as well. fd: OwnedFd, diff --git a/src/fds.rs b/src/fds.rs index 938f901ba..7d3316f29 100644 --- a/src/fds.rs +++ b/src/fds.rs @@ -105,7 +105,7 @@ pub fn heightenize_fd(fd: OwnedFd, input_has_cloexec: bool) -> nix::Result c_int { // Note we don't want to overwrite existing flags like O_NONBLOCK which may be set. So fetch the // existing flags and modify them. diff --git a/src/fork_exec/postfork.rs b/src/fork_exec/postfork.rs index 67cb6bb22..56d0d59a0 100644 --- a/src/fork_exec/postfork.rs +++ b/src/fork_exec/postfork.rs @@ -145,8 +145,8 @@ pub fn child_setup_process( err = unsafe { libc::dup2(act.src, act.target) }; } else { // This is a weird case like /bin/cmd 6< file.txt - // The opened file (which is CLO_EXEC) wants to be dup2'd to its own fd. - // We need to unset the CLO_EXEC flag. + // The opened file (which is CLOEXEC) wants to be dup2'd to its own fd. + // We need to unset the CLOEXEC flag. err = clear_cloexec(act.src); } if err < 0 { @@ -498,7 +498,7 @@ fn err_or_no_exec_handling(interpreter: &CStr, actual_cmd: &CStr) { /// Returns the interpreter for the specified script. Returns None if file is not a script with a /// shebang. fn get_interpreter<'a>(command: &CStr, buffer: &'a mut [u8]) -> Option<&'a CStr> { - // OK to not use CLO_EXEC here because this is only called after fork. + // OK to not use CLOEXEC here because this is only called after fork. let fd = unsafe { libc::open(command.as_ptr(), libc::O_RDONLY) }; let mut idx = 0; if fd >= 0 { diff --git a/src/io.rs b/src/io.rs index 84d89f5b0..5a463bde2 100644 --- a/src/io.rs +++ b/src/io.rs @@ -581,7 +581,7 @@ pub fn append_from_specs(&mut self, specs: &RedirectionSpecList, pwd: &wstr) -> } _ => { // We have a path-based redirection. Resolve it to a file. - // Mark it as CLO_EXEC because we don't want it to be open in any child. + // Mark it as CLOEXEC because we don't want it to be open in any child. let path = path_apply_working_directory(&spec.target, pwd); let oflags = spec.oflags(); diff --git a/src/parser.rs b/src/parser.rs index 4ebb687a8..1627044a9 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1108,7 +1108,7 @@ pub fn profile_items_mut(&mut self) -> &mut Vec { /// Flush profiling data to the given filename. pub fn flush_profiling(&mut self, path: &OsStr) { - // Save profiling information. OK to not use CLO_EXEC here because this is called while fish is + // Save profiling information. OK to not use CLOEXEC here because this is called while fish is // exiting (and hence will not fork). let mut f = match std::fs::File::create(path) { Ok(f) => f, diff --git a/src/redirection.rs b/src/redirection.rs index 5e1bb5e45..936034fdb 100644 --- a/src/redirection.rs +++ b/src/redirection.rs @@ -139,7 +139,7 @@ pub fn fd_for_target_fd(&self, target: RawFd) -> RawFd { pub fn add_dup2(&mut self, src: RawFd, target: RawFd) { assert!(src >= 0 && target >= 0, "Invalid fd in add_dup2"); // Note: record these even if src and target is the same. - // This is a note that we must clear the CLO_EXEC bit. + // This is a note that we must clear the CLOEXEC bit. self.actions.push(Dup2Action { src, target }); } diff --git a/src/universal_notifier/notifyd.rs b/src/universal_notifier/notifyd.rs index 57295807e..8001e373c 100644 --- a/src/universal_notifier/notifyd.rs +++ b/src/universal_notifier/notifyd.rs @@ -61,14 +61,14 @@ pub fn new() -> Option { ); return None; } - // Mark us for non-blocking reads, and CLO_EXEC. + // Mark us for non-blocking reads, and CLOEXEC. let _ = make_fd_nonblocking(notify_fd); let _ = set_cloexec(notify_fd, true); // Serious hack: notify_fd is likely the read end of a pipe. The other end is owned by - // libnotify, which does not mark it as CLO_EXEC (it should!). The next fd is probably + // libnotify, which does not mark it as CLOEXEC (it should!). The next fd is probably // notify_fd + 1. Do it ourselves. If the implementation changes and some other FD gets - // marked as CLO_EXEC, that's probably a good thing. + // marked as CLOEXEC, that's probably a good thing. let _ = set_cloexec(notify_fd + 1, true); Some(Self { diff --git a/tests/checks/fds.fish b/tests/checks/fds.fish index 8166fd44f..9f0c67fcc 100644 --- a/tests/checks/fds.fish +++ b/tests/checks/fds.fish @@ -37,7 +37,7 @@ $helper print_fds 5>&2 # This attempts to trip a case where the file opened in fish # has the same fd as the redirection. In this case, the dup2 -# does not clear the CLO_EXEC bit. +# does not clear the CLOEXEC bit. $helper print_fds 4