File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change @@ -2211,24 +2211,12 @@ int mingw_raise(int sig)
2211
2211
2212
2212
int link (const char * oldpath , const char * newpath )
2213
2213
{
2214
- typedef BOOL (WINAPI * T )(LPCWSTR , LPCWSTR , LPSECURITY_ATTRIBUTES );
2215
- static T create_hard_link = NULL ;
2216
2214
wchar_t woldpath [MAX_PATH ], wnewpath [MAX_PATH ];
2217
2215
if (xutftowcs_path (woldpath , oldpath ) < 0 ||
2218
2216
xutftowcs_path (wnewpath , newpath ) < 0 )
2219
2217
return -1 ;
2220
2218
2221
- if (!create_hard_link ) {
2222
- create_hard_link = (T ) GetProcAddress (
2223
- GetModuleHandle ("kernel32.dll" ), "CreateHardLinkW" );
2224
- if (!create_hard_link )
2225
- create_hard_link = (T )- 1 ;
2226
- }
2227
- if (create_hard_link == (T )- 1 ) {
2228
- errno = ENOSYS ;
2229
- return -1 ;
2230
- }
2231
- if (!create_hard_link (wnewpath , woldpath , NULL )) {
2219
+ if (!CreateHardLinkW (wnewpath , woldpath , NULL )) {
2232
2220
errno = err_win_to_posix (GetLastError ());
2233
2221
return -1 ;
2234
2222
}
You can’t perform that action at this time.
0 commit comments