Changeset 2484 in kBuild
- Timestamp:
- Jul 21, 2011 7:01:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/mscfakes.c
r2476 r2484 216 216 { 217 217 int rc = 0; 218 int saved_errno;219 218 int fMustBeDir; 220 219 char *pszPathFree = msc_fix_path(&pszPath, &fMustBeDir); … … 259 258 260 259 260 typedef BOOL (WINAPI *PFNCREATEHARDLINKA)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES); 261 261 int link(const char *pszDst, const char *pszLink) 262 262 { 263 if (CreateHardLink(pszDst, pszLink, NULL)) 263 static PFNCREATEHARDLINKA s_pfnCreateHardLinkA = NULL; 264 static int s_fTried = FALSE; 265 266 /* The API was introduced in Windows 2000, so resolve it dynamically. */ 267 if (!s_pfnCreateHardLinkA) 268 { 269 if (!s_fTried) 270 { 271 HMODULE hmod = LoadLibrary("KERNEL32.DLL"); 272 if (hmod) 273 *(FARPROC *)&s_pfnCreateHardLinkA = GetProcAddress(hmod, "CreateHardLinkA"); 274 s_fTried = TRUE; 275 } 276 if (!s_pfnCreateHardLinkA) 277 { 278 errno = ENOSYS; 279 return -1; 280 } 281 } 282 283 if (s_pfnCreateHardLinkA(pszLink, pszDst, NULL)) 264 284 return 0; 265 285 return msc_set_errno(GetLastError());
Note:
See TracChangeset
for help on using the changeset viewer.