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