aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_upgrade/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_upgrade/file.c')
-rw-r--r--src/bin/pg_upgrade/file.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
index 09bf886ed71..cc8a675d009 100644
--- a/src/bin/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -26,10 +26,6 @@
#include "storage/checksum.h"
#include "storage/checksum_impl.h"
-#ifdef WIN32
-static int win32_pghardlink(const char *src, const char *dst);
-#endif
-
/*
* cloneFile()
@@ -151,7 +147,7 @@ void
linkFile(const char *src, const char *dst,
const char *schemaName, const char *relName)
{
- if (pg_link_file(src, dst) < 0)
+ if (link(src, dst) < 0)
pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
schemaName, relName, src, dst, strerror(errno));
}
@@ -369,29 +365,10 @@ check_hard_link(void)
snprintf(new_link_file, sizeof(new_link_file), "%s/PG_VERSION.linktest", new_cluster.pgdata);
unlink(new_link_file); /* might fail */
- if (pg_link_file(existing_file, new_link_file) < 0)
+ if (link(existing_file, new_link_file) < 0)
pg_fatal("could not create hard link between old and new data directories: %s\n"
"In link mode the old and new data directories must be on the same file system.\n",
strerror(errno));
unlink(new_link_file);
}
-
-#ifdef WIN32
-/* implementation of pg_link_file() on Windows */
-static int
-win32_pghardlink(const char *src, const char *dst)
-{
- /*
- * CreateHardLinkA returns zero for failure
- * https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createhardlinka
- */
- if (CreateHardLinkA(dst, src, NULL) == 0)
- {
- _dosmaperr(GetLastError());
- return -1;
- }
- else
- return 0;
-}
-#endif