Re: BUG #15105: OpenTransientFile() should be paired with CloseTransientFile() rather than close()
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: bianpan2016@163.com, pgsql-bugs@lists.postgresql.org,
Robert Haas <robertmhaas@gmail.com>
Date: 2018-03-09T14:57:48Z
Lists: pgsql-bugs
Michael Paquier <michael@paquier.xyz> writes: > On Fri, Mar 09, 2018 at 03:29:25AM +0000, PG Bug reporting form wrote: >> Details: The handler opened with OpenTransientFile() should be closed with >> CloseTransientFile(). However, in function dsm_impl_mmap(), on a certain >> path, the return value of OpenTransientFile() (at line 885) is passed to >> close() (at line 926). It is better to use CloseTransientFile() here, as >> done at line 909. > Good catch! This is visibly a copy-paste error coming from > dsm_impl_posix(). As a patch it gives the attached. I am adding also > Robert in CC for awareness. Presumably, this would have been found sooner if AtEOXact_Files acted like most other end-of-xact cleanup functions and whined about leaked resources (in the commit case). I wonder why it doesn't. regards, tom lane
Commits
-
In AtEOXact_Files, complain if any files remain unclosed at commit.
- 9cb7db3f0c1f 11.0 landed
-
Fix incorrect close() call in dsm_impl_mmap().
- 231bcd0803eb 11.0 landed
- f530af8fc931 9.4.18 landed
- 494f3cb5bbda 9.6.9 landed
- 2224d1ce1447 9.5.13 landed
- 02ba72ec1cf5 10.4 landed