forked from vmware-archive/pg_rewind
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.c
More file actions
32 lines (28 loc) · 703 Bytes
/
Copy pathutil.c
File metadata and controls
32 lines (28 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*-------------------------------------------------------------------------
*
* util.c
* Misc utility functions
*
* Portions Copyright (c) 2013 VMware, Inc. All Rights Reserved.
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "common/relpath.h"
#include "catalog/catalog.h"
#include "catalog/pg_tablespace.h"
#include "pg_rewind.h"
char *
datasegpath(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
{
char *path = relpathperm(rnode, forknum);
if (segno > 0)
{
char *segpath = pg_malloc(strlen(path) + 13);
sprintf(segpath, "%s.%u", path, segno);
pg_free(path);
return segpath;
}
else
return path;
}