On Fri, 25 Jul 2025 23:09:48 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
> Fix gcc warning about double close. forkedChildProcess() calls > closeDescriptors(), which always closes STDERR_FILENO + 1 and STDERR_FILENO + > 2. However, if it fails at some point after that, then forkedChildProcess() > will attempt to close these same two files again. Fixed by making > forkedChildProcess() no longer attempt to close these two files. > > I first verified the warning by configuring with > --with-extra-cflags=-fanalyzer, and then verified the fix by doing the same. > > Tested by running jdi nsk test. I'll add some more CI testing. This looks reasonable to me. I just have trivial comment about the code comment introduced in this change, which I've added inline. src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c line 82: > 80: * descriptors afresh. > 81: * > 82: * WARNING: We are not allowed to fail until after these two closes > are Hello Chris, would it be better to word this as "We are not allowed to return from this function until after ...."? ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/26487#pullrequestreview-3059210605 PR Review Comment: https://git.openjdk.org/jdk/pull/26487#discussion_r2233741615