There is no need to use explicit sizeof(buf) as pipe buffer size.
System defaults should be fine.

CRT _pipe() function should be just a wrapper around WinAPI CreatePipe()
function and zero value as pipe buffer size argument for WinAPI
CreatePipe() function is documented as the system default buffer size:
https://learn.microsoft.com/en-us/windows/win32/api/namedpipeapi/nf-namedpipeapi-createpipe
---
 mingw-w64-crt/testcases/t_assert.c           | 2 +-
 mingw-w64-crt/testcases/t_safe_flush.c       | 2 +-
 mingw-w64-crt/testcases/t_stderr_buffering.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mingw-w64-crt/testcases/t_assert.c 
b/mingw-w64-crt/testcases/t_assert.c
index e66c406e88fa..7e74ea70e83e 100644
--- a/mingw-w64-crt/testcases/t_assert.c
+++ b/mingw-w64-crt/testcases/t_assert.c
@@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
         ssize_t size;
         char buf[512];
 
-        assert(_pipe(pipefd, sizeof(buf), O_NOINHERIT) == 0);
+        assert(_pipe(pipefd, 0, O_NOINHERIT) == 0);
 
         /* set stderr fd to write side of pipe, will be used by _spawnl() */
         assert((back_errfd = dup(STDERR_FILENO)) >= 0);
diff --git a/mingw-w64-crt/testcases/t_safe_flush.c 
b/mingw-w64-crt/testcases/t_safe_flush.c
index 79f40685afcd..3e967f323725 100644
--- a/mingw-w64-crt/testcases/t_safe_flush.c
+++ b/mingw-w64-crt/testcases/t_safe_flush.c
@@ -100,7 +100,7 @@ int parent_main(const char *argv0) {
     size_t size = 0;
     char buf[512];
 
-    assert(_pipe(pipefd, sizeof(buf), O_NOINHERIT) == 0);
+    assert(_pipe(pipefd, 0, O_NOINHERIT) == 0);
 
     /* set stdout fd to write side of pipe, will be used by _spawnl() */
     assert((back_outfd = dup(STDOUT_FILENO)) >= 0);
diff --git a/mingw-w64-crt/testcases/t_stderr_buffering.c 
b/mingw-w64-crt/testcases/t_stderr_buffering.c
index a2498c7e2257..35a885a714c4 100644
--- a/mingw-w64-crt/testcases/t_stderr_buffering.c
+++ b/mingw-w64-crt/testcases/t_stderr_buffering.c
@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) {
         size_t size = 0;
         char buf[512];
 
-        assert(_pipe(pipefd, sizeof(buf), _O_NOINHERIT) == 0);
+        assert(_pipe(pipefd, 0, _O_NOINHERIT) == 0);
 
         /* set stderr fd to write side of pipe, will be used by _spawnl() */
         assert((back_errfd = dup(STDERR_FILENO)) >= 0);
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to