bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* Bug in test-fcntl.c
@ 2021-05-08 23:10 Nicholas Gaya
  2021-05-09  2:03 ` Bruno Haible
  0 siblings, 1 reply; 6+ messages in thread
From: Nicholas Gaya @ 2021-05-08 23:10 UTC (permalink / raw)
  To: bug-gnulib

Hello,

I believe I have found a bug in gnulib's test-fcntl.c. In order to test the functionality of fcntl with FD_DUPFD_CLOEXEC, the test dups an open file descriptor using the flag and execs a child process to check that the file descriptor gets closed on exec. The problem is that the current test code assumes that the duplicated file descriptor will have constant value 10, which will not be true if fd 10 is already in use (which happens to be the case in the testing environment where I ran into this bug).

To fix this, we can pass the file descriptor returned by fcntl as an argument to the child process. Please see this proposed patch for details: https://gist.github.com/nickgaya/2a70ebdce8c020481d3e5b6c3696fe7b

Best,
Nicholas Gaya

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-14 21:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 23:10 Bug in test-fcntl.c Nicholas Gaya
2021-05-09  2:03 ` Bruno Haible
2021-05-09  3:27   ` Nicholas Gaya
2021-05-09 12:24     ` Bruno Haible
2021-05-11  3:25       ` Nicholas Gaya
2021-05-14 21:53         ` Bruno Haible

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).