vere: compat: polyfill link() on windows

This commit is contained in:
Joe Bryan 2022-05-18 16:33:27 -04:00
parent 45d4c5ef68
commit baf690c85a
2 changed files with 11 additions and 0 deletions

View File

@ -134,6 +134,16 @@ int err_win_to_posix(DWORD winerr)
return error;
}
int link(const char *path1, const char *path2)
{
if ( CreateHardLinkA(path2, path1, NULL) ) {
return 0;
}
errno = err_win_to_posix(GetLastError());
return -1;
}
// from msys2 mingw-packages-dev patches
// -----------------------------------------------------------------------

View File

@ -3,6 +3,7 @@
#define mkdir(A, B) mkdir(A)
int link(const char *path1, const char *path2);
char *realpath(const char *path, char *resolved_path);
int fdatasync(int fd);
int utimes(const char *path, const struct timeval times[2]);