1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Move pg_upgrade's Windows link() implementation to AC_REPLACE_FUNCS

This way we can make use of it in other components as well, and it
fits better with the rest of the build system.

Discussion: https://www.postgresql.org/message-id/flat/72fff73f-dc9c-4ef4-83e8-d2e60c98df48%402ndquadrant.com
This commit is contained in:
Peter Eisentraut
2020-03-04 08:05:33 +01:00
parent d677550493
commit 0ad6f848ee
9 changed files with 60 additions and 28 deletions

35
src/port/link.c Normal file
View File

@@ -0,0 +1,35 @@
/*-------------------------------------------------------------------------
*
* link.c
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/port/link.c
*
*-------------------------------------------------------------------------
*/
#include "c.h"
#ifdef WIN32
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;
}
#endif