RFR: 8361873: [GCC static analyzer] exec_md.c forkedChildProcess potential double 'close' of file descriptor '3' [v2]
Chris Plummer
cjplummer at openjdk.org
Sun Jul 27 18:24:29 UTC 2025
> 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.
Chris Plummer has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
- Merge branch 'master' into 8361873_jdwp_close_fd
Merge
- fix gcc warning about double close()
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26487/files
- new: https://git.openjdk.org/jdk/pull/26487/files/088932e9..4095d6ce
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26487&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26487&range=00-01
Stats: 106271 lines in 2540 files changed: 64936 ins; 26240 del; 15095 mod
Patch: https://git.openjdk.org/jdk/pull/26487.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26487/head:pull/26487
PR: https://git.openjdk.org/jdk/pull/26487
More information about the serviceability-dev
mailing list