]> granicus.if.org Git - postgresql/commit
Refactor new file permission handling
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 23 Sep 2017 13:49:22 +0000 (09:49 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 23 Sep 2017 14:16:18 +0000 (10:16 -0400)
commit0c5803b450e0cc29b3527df3f352e6f18a038cc6
treeea9dfa278b42aae6cb47108e50133e9716fcefc2
parent404ba54e8fd3036eee0f9241f68b17092ce734ee
Refactor new file permission handling

The file handling functions from fd.c were called with a diverse mix of
notations for the file permissions when they were opening new files.
Almost all files created by the server should have the same permissions
set.  So change the API so that e.g. OpenTransientFile() automatically
uses the standard permissions set, and OpenTransientFilePerm() is a new
function that takes an explicit permissions set for the few cases where
it is needed.  This also saves an unnecessary argument for call sites
that are just opening an existing file.

While we're reviewing these APIs, get rid of the FileName typedef and
use the standard const char * for the file name and mode_t for the file
mode.  This makes these functions match other file handling functions
and removes an unnecessary layer of mysteriousness.  We can also get rid
of a few casts that way.

Author: David Steele <david@pgmasters.net>
21 files changed:
contrib/pg_stat_statements/pg_stat_statements.c
src/backend/access/heap/rewriteheap.c
src/backend/access/transam/slru.c
src/backend/access/transam/timeline.c
src/backend/access/transam/twophase.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/catalog/catalog.c
src/backend/libpq/be-fsstubs.c
src/backend/replication/logical/origin.c
src/backend/replication/logical/reorderbuffer.c
src/backend/replication/logical/snapbuild.c
src/backend/replication/slot.c
src/backend/replication/walsender.c
src/backend/storage/file/copydir.c
src/backend/storage/file/fd.c
src/backend/storage/ipc/dsm_impl.c
src/backend/storage/smgr/md.c
src/backend/utils/cache/relmapper.c
src/backend/utils/misc/guc.c
src/include/storage/fd.h