1 /*-------------------------------------------------------------------------
2  *
3  * link.c
4  *
5  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  *
8  *
9  * IDENTIFICATION
10  *	  src/port/link.c
11  *
12  *-------------------------------------------------------------------------
13  */
14 
15 #include "c.h"
16 
17 #ifdef WIN32
18 
19 int
link(const char * src,const char * dst)20 link(const char *src, const char *dst)
21 {
22 	/*
23 	 * CreateHardLinkA returns zero for failure
24 	 * https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createhardlinka
25 	 */
26 	if (CreateHardLinkA(dst, src, NULL) == 0)
27 	{
28 		_dosmaperr(GetLastError());
29 		return -1;
30 	}
31 	else
32 		return 0;
33 }
34 
35 #endif
36