aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 9a18fd6e839..be0cc555940 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.17 2005/04/14 20:03:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.18 2005/05/02 18:26:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -341,8 +341,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
/*
* All seems well, create the symlink
*/
- linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, tablespaceoid);
+ linkloc = GetTablespacePath(tablespaceoid);
if (symlink(location, linkloc) < 0)
ereport(ERROR,
@@ -495,8 +494,7 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
char *subfile;
struct stat st;
- location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(location, "%s/pg_tblspc/%u", DataDir, tablespaceoid);
+ location = GetTablespacePath(tablespaceoid);
/*
* Check if the tablespace still contains any files. We try to rmdir
@@ -1036,8 +1034,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record)
set_short_version(location);
/* Create the symlink if not already present */
- linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1);
- sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, xlrec->ts_id);
+ linkloc = GetTablespacePath(xlrec->ts_id);
if (symlink(location, linkloc) < 0)
{