Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickgaya/2a70ebdce8c020481d3e5b6c3696fe7b to your computer and use it in GitHub Desktop.
Save nickgaya/2a70ebdce8c020481d3e5b6c3696fe7b to your computer and use it in GitHub Desktop.
From 66fc07c645e8fcd23627c54f76b7cc408b8dfa3a Mon Sep 17 00:00:00 2001
From: Nick Gaya <nicholasgaya+github@gmail.com>
Date: Sat, 8 May 2021 01:11:00 -0700
Subject: [PATCH] fcntl tests: ensure fd is available when testing
F_DUPFD_CLOEXEC
---
tests/test-fcntl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c
index caf629dab..19225fbef 100644
--- a/tests/test-fcntl.c
+++ b/tests/test-fcntl.c
@@ -416,7 +416,8 @@ main (int argc, char *argv[])
ASSERT (unlink (file) == 0);
/* Test whether F_DUPFD_CLOEXEC is effective. */
- ASSERT (fcntl (1, F_DUPFD_CLOEXEC, 10) >= 0);
+ close(10);
+ ASSERT (fcntl (1, F_DUPFD_CLOEXEC, 10) == 10);
#if defined _WIN32 && !defined __CYGWIN__
return _execl ("./test-fcntl", "./test-fcntl", "child", NULL);
#else
--
2.31.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment