summaryrefslogtreecommitdiff
path: root/src/backend/storage/smgr/md.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/smgr/md.c')
-rw-r--r--src/backend/storage/smgr/md.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index c697af00d98..9889ad6ad88 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -294,19 +294,8 @@ do_truncate(const char *path)
{
int save_errno;
int ret;
- int fd;
- /* truncate(2) would be easier here, but Windows hasn't got it */
- fd = OpenTransientFile(path, O_RDWR | PG_BINARY);
- if (fd >= 0)
- {
- ret = ftruncate(fd, 0);
- save_errno = errno;
- CloseTransientFile(fd);
- errno = save_errno;
- }
- else
- ret = -1;
+ ret = pg_truncate(path, 0);
/* Log a warning here to avoid repetition in callers. */
if (ret < 0 && errno != ENOENT)