diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 1008873..5e3932b 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -970,7 +970,16 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, strncmp(de->d_name, PG_STAT_TMP_DIR, strlen(PG_STAT_TMP_DIR)) == 0) { if (!sizeonly) + { + /* If pg_stat_tmp is a symlink, write it as a directory anyway */ +#ifndef WIN32 + if (S_ISLNK(statbuf.st_mode)) +#else + if (pgwin32_is_junction(pathbuf)) +#endif + statbuf.st_mode = S_IFDIR | S_IRWXU; _tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf); + } size += 512; continue; } @@ -982,7 +991,16 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, if (strcmp(de->d_name, "pg_replslot") == 0) { if (!sizeonly) + { + /* If pg_replslot is a symlink, write it as a directory anyway */ +#ifndef WIN32 + if (S_ISLNK(statbuf.st_mode)) +#else + if (pgwin32_is_junction(pathbuf)) +#endif + statbuf.st_mode = S_IFDIR | S_IRWXU; _tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf); + } size += 512; /* Size of the header just added */ continue; }