RFR: JDK-8313691: use close after failing os::fdopen in vmError

Matthias Baesken mbaesken at openjdk.org
Thu Aug 3 14:09:35 UTC 2023


In vmError.cpp we use os::fdopen and in case this is successful pass the returned file pointer to a fileStream constructor.
The fileStream object calls fclose on our file pointer  in destruction (and this closes also the underlying file descriptor fd).

However in case of failing os::fdopen we do not create (and later destruct)  a fileStream object so direct call to close might be needed. I also adjusted a comment to make it  even clearer that the fileStream object fcloses the file pointer on the destructor.

-------------

Commit messages:
 - JDK-8313691

Changes: https://git.openjdk.org/jdk/pull/15139/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15139&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8313691
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15139.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15139/head:pull/15139

PR: https://git.openjdk.org/jdk/pull/15139


More information about the hotspot-dev mailing list