[newlib-cygwin] Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXEC
Jeremy Drake
jeremyd2019@sourceware.org
Wed Jul 9 17:30:56 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1abf10e2257b5f3dcbafdb55a86f8adb4c9158ae
commit 1abf10e2257b5f3dcbafdb55a86f8adb4c9158ae
Author: Jeremy Drake <cygwin@jdrake.com>
Date: Tue Jul 8 14:40:11 2025 -0700
Cygwin: testsuite: test posix_spawn_file_actions_addopen with O_CLOEXEC
This was previously not handled correctly by newlib.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
Diff:
---
winsup/testsuite/winsup.api/posix_spawn/fds.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/winsup/testsuite/winsup.api/posix_spawn/fds.c b/winsup/testsuite/winsup.api/posix_spawn/fds.c
index 98ce36ff3..dab96ab33 100644
--- a/winsup/testsuite/winsup.api/posix_spawn/fds.c
+++ b/winsup/testsuite/winsup.api/posix_spawn/fds.c
@@ -74,6 +74,16 @@ int main (int argc, char **argv)
exitStatus (status, 0);
errCode (posix_spawn_file_actions_destroy (&fa));
+ /* test posix_spawn_file_actions_addopen with O_CLOEXEC */
+ errCode (posix_spawn_file_actions_init (&fa));
+ errCode (posix_spawn_file_actions_addopen (&fa, 0, "/dev/zero",
+ O_RDONLY|O_CLOEXEC, 0644));
+ childargv[3] = "<ENOENT>";
+ errCode (posix_spawn (&pid, MYSELF, &fa, NULL, childargv, environ));
+ negError (waitpid (pid, &status, 0));
+ exitStatus (status, 0);
+ errCode (posix_spawn_file_actions_destroy (&fa));
+
/* test posix_spawn_file_actions_adddup2 */
errCode (posix_spawn_file_actions_init (&fa));
errCode (posix_spawn_file_actions_adddup2 (&fa, fd, 0));
More information about the Cygwin-cvs
mailing list