Refactor code checking for file existence

Michael Paquier <michael@paquier.xyz>

Commit: e72a37528ddaadd796be73fe9b0a0c08b18476d2
Author: Michael Paquier <michael@paquier.xyz>
Date: 2024-01-12T03:04:51Z
Releases: 17.0
Refactor code checking for file existence

jit.c and dfgr.c had a copy of the same code to check if a file exists
or not, with a twist: jit.c did not check for EACCES when failing the
stat() call for the path whose existence is tested.  This refactored
routine will be used by an upcoming patch.

Reviewed-by: Ashutosh Bapat
Discussion: https://postgr.es/m/ZTiV8tn_MIb_H2rE@paquier.xyz

Files

PathChange+/−
src/backend/jit/jit.c modified +1 −19
src/backend/storage/file/fd.c modified +23 −0
src/backend/utils/fmgr/dfmgr.c modified +4 −21
src/include/storage/fd.h modified +1 −0

Discussion