aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-09-03 09:11:54 +0900
committerMichael Paquier <michael@paquier.xyz>2024-09-03 09:11:54 +0900
commitc7cd2d6ed082a4638172acece33ed6f36da96263 (patch)
treef4a8ab1b49eac09019d6b6a6114e9d9a00e9f1a8 /src/backend/access/transam/xlog.c
parent94eec79633f284488de69e253857e44aad10c730 (diff)
downloadpostgresql-c7cd2d6ed082a4638172acece33ed6f36da96263.tar.gz
postgresql-c7cd2d6ed082a4638172acece33ed6f36da96263.zip
Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder
Similarly to 2065ddf5e34c, this introduces a define for "pg_tblspc". This makes the style more consistent with the existing PG_STAT_TMP_DIR, for example. There is a difference with the other cases with the introduction of PG_TBLSPC_DIR_SLASH, required in two places for recovery and backups. Author: Bertrand Drouvot Reviewed-by: Ashutosh Bapat, Álvaro Herrera, Yugo Nagata, Michael Paquier Discussion: https://postgr.es/m/ZryVvjqS9SnV1GPP@ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ee0fb0e28f8..4e06d86196f 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8944,10 +8944,10 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
datadirpathlen = strlen(DataDir);
/* Collect information about all tablespaces */
- tblspcdir = AllocateDir("pg_tblspc");
- while ((de = ReadDir(tblspcdir, "pg_tblspc")) != NULL)
+ tblspcdir = AllocateDir(PG_TBLSPC_DIR);
+ while ((de = ReadDir(tblspcdir, PG_TBLSPC_DIR)) != NULL)
{
- char fullpath[MAXPGPATH + 10];
+ char fullpath[MAXPGPATH + sizeof(PG_TBLSPC_DIR)];
char linkpath[MAXPGPATH];
char *relpath = NULL;
char *s;
@@ -8970,7 +8970,7 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
if (*badp != '\0' || errno == EINVAL || errno == ERANGE)
continue;
- snprintf(fullpath, sizeof(fullpath), "pg_tblspc/%s", de->d_name);
+ snprintf(fullpath, sizeof(fullpath), "%s/%s", PG_TBLSPC_DIR, de->d_name);
de_type = get_dirent_type(fullpath, de, false, ERROR);
@@ -9031,8 +9031,8 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
* In this case, we store a relative path rather than an
* absolute path into the tablespaceinfo.
*/
- snprintf(linkpath, sizeof(linkpath), "pg_tblspc/%s",
- de->d_name);
+ snprintf(linkpath, sizeof(linkpath), "%s/%s",
+ PG_TBLSPC_DIR, de->d_name);
relpath = pstrdup(linkpath);
}
else