2020-03-04 08:05:33 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
2022-08-04 23:36:50 +02:00
|
|
|
* win32link.c
|
2020-03-04 08:05:33 +01:00
|
|
|
*
|
2023-01-02 21:00:37 +01:00
|
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
2020-03-04 08:05:33 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2022-08-04 23:36:50 +02:00
|
|
|
* src/port/win32link.c
|
2020-03-04 08:05:33 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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;
|
|
|
|
}
|