This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 35452445223 drivers/pipes: Close the write end when pipe2() or
file_pipe() fails.
35452445223 is described below
commit 35452445223a9a691161cae82ec5a1296dfc7235
Author: Marco Casaroli <[email protected]>
AuthorDate: Sat Oct 24 00:37:27 2026 +0200
drivers/pipes: Close the write end when pipe2() or file_pipe() fails.
pipe2() and file_pipe() open the write end and then clear its O_NONBLOCK
with FIONBIO. When FIONBIO failed, both went to the error path that only
unregisters the pipe, so the open write end stayed open. Close it.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
drivers/pipes/pipe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c
index 7ea926d007b..97e4a8e682a 100644
--- a/drivers/pipes/pipe.c
+++ b/drivers/pipes/pipe.c
@@ -211,7 +211,7 @@ int file_pipe(FAR struct file *filep[2], size_t bufsize,
int flags)
ret = file_ioctl(filep[1], FIONBIO, &nonblock);
if (ret < 0)
{
- goto errout_with_driver;
+ goto errout_with_wrfd;
}
}
@@ -285,7 +285,7 @@ int pipe2(int fd[2], int flags)
ret = ioctl(fd[1], FIONBIO, &nonblock);
if (ret < 0)
{
- goto errout_with_driver;
+ goto errout_with_wrfd;
}
}