From 5021639db100d867bf9d81d79ca0f47555f2b0db Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 11 Feb 2024 12:16:58 -0800 Subject: [PATCH] Correct some comments and duplicative error messages If we fail to create a pipe, we will report that fact in multiple places; remove some redundant error reporting. --- src/exec.rs | 1 - src/fd_monitor.rs | 1 - src/fds.rs | 2 +- src/io.rs | 4 ++-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/exec.rs b/src/exec.rs index b397ba7b6..ff368523a 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -138,7 +138,6 @@ pub fn exec_job(parser: &Parser, job: &Job, block_io: IoChain) -> bool { if !p.is_last_in_job { let Ok(pipes) = make_autoclose_pipes() else { FLOGF!(warning, "%ls", wgettext!(PIPE_ERROR)); - perror("pipe"); aborted_pipeline = true; abort_pipeline_from(job, i); break; diff --git a/src/fd_monitor.rs b/src/fd_monitor.rs index 5ab7e2111..314a63665 100644 --- a/src/fd_monitor.rs +++ b/src/fd_monitor.rs @@ -63,7 +63,6 @@ impl FdEventSignaller { { // Implementation using pipes. let Ok(pipes) = make_autoclose_pipes() else { - perror("pipe"); exit_without_destructors(1); }; make_fd_nonblocking(pipes.read.as_raw_fd()).unwrap(); diff --git a/src/fds.rs b/src/fds.rs index 88b5411c3..2bc49165d 100644 --- a/src/fds.rs +++ b/src/fds.rs @@ -149,7 +149,7 @@ pub fn make_autoclose_pipes() -> nix::Result { Ok(pipes) => pipes, Err(err) => { FLOG!(warning, PIPE_ERROR); - perror("pipe2"); + perror("pipe"); return Err(err); } }; diff --git a/src/io.rs b/src/io.rs index 9e744b673..c57c53e03 100644 --- a/src/io.rs +++ b/src/io.rs @@ -345,12 +345,12 @@ pub struct IoBufferfill { } impl IoBufferfill { /// Create an io_bufferfill_t which, when written from, fills a buffer with the contents. - /// \returns nullptr on failure, e.g. too many open fds. + /// \returns an error on failure, e.g. too many open fds. pub fn create() -> io::Result> { Self::create_opts(0, STDOUT_FILENO) } /// Create an io_bufferfill_t which, when written from, fills a buffer with the contents. - /// \returns nullptr on failure, e.g. too many open fds. + /// \returns an error on failure, e.g. too many open fds. /// /// \param target the fd which this will be dup2'd to - typically stdout. pub fn create_opts(buffer_limit: usize, target: RawFd) -> io::Result> {