summaryrefslogtreecommitdiffstats
path: root/src/port/win32link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/win32link.c')
-rw-r--r--src/port/win32link.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/port/win32link.c b/src/port/win32link.c
new file mode 100644
index 0000000..d1442ee
--- /dev/null
+++ b/src/port/win32link.c
@@ -0,0 +1,31 @@
+/*-------------------------------------------------------------------------
+ *
+ * win32link.c
+ *
+ * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * src/port/win32link.c
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "c.h"
+
+int
+link(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;
+}