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:
35
src/port/link.c
Normal file
35
src/port/link.c
Normal 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
|
Reference in New Issue
Block a user