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 @@ -2153,24 +2153,12 @@ int mingw_raise(int sig)
21532153
21542154int link (const char * oldpath , const char * newpath )
21552155{
2156- typedef BOOL (WINAPI * T )(LPCWSTR , LPCWSTR , LPSECURITY_ATTRIBUTES );
2157- static T create_hard_link = NULL ;
21582156 wchar_t woldpath [MAX_PATH ], wnewpath [MAX_PATH ];
21592157 if (xutftowcs_path (woldpath , oldpath ) < 0 ||
21602158 xutftowcs_path (wnewpath , newpath ) < 0 )
21612159 return -1 ;
21622160
2163- if (!create_hard_link ) {
2164- create_hard_link = (T ) GetProcAddress (
2165- GetModuleHandle ("kernel32.dll" ), "CreateHardLinkW" );
2166- if (!create_hard_link )
2167- create_hard_link = (T )- 1 ;
2168- }
2169- if (create_hard_link == (T )- 1 ) {
2170- errno = ENOSYS ;
2171- return -1 ;
2172- }
2173- if (!create_hard_link (wnewpath , woldpath , NULL )) {
2161+ if (!CreateHardLinkW (wnewpath , woldpath , NULL )) {
21742162 errno = err_win_to_posix (GetLastError ());
21752163 return -1 ;
21762164 }
You can’t perform that action at this time.
0 commit comments