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

Tobias Hartmann thartmann at openjdk.org
Fri Aug 4 06:43:28 UTC 2023


On Thu, 3 Aug 2023 14:02:22 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> 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.

Should we re-add the close in the failing case that we backed out with https://github.com/openjdk/jdk/commit/4577147993c2f87e6ba298a664acad5decc968f0?

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

PR Comment: https://git.openjdk.org/jdk/pull/15139#issuecomment-1665090569


More information about the hotspot-dev mailing list