diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 3713fea95..84522d3ea 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -441,22 +441,14 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) | |||
441 | #if ENABLE_FEATURE_EXTRA_FILE_DATA | 441 | #if ENABLE_FEATURE_EXTRA_FILE_DATA |
442 | fh = CreateFile(file_name, 0, 0, NULL, OPEN_EXISTING, | 442 | fh = CreateFile(file_name, 0, 0, NULL, OPEN_EXISTING, |
443 | FILE_FLAG_BACKUP_SEMANTICS, NULL); | 443 | FILE_FLAG_BACKUP_SEMANTICS, NULL); |
444 | if (fh == INVALID_HANDLE_VALUE) | 444 | if (fh != INVALID_HANDLE_VALUE && |
445 | goto error; | 445 | GetFileInformationByHandle(fh, &hdata)) { |
446 | |||
447 | if (GetFileInformationByHandle(fh, &hdata)) { | ||
448 | buf->st_dev = hdata.dwVolumeSerialNumber; | 446 | buf->st_dev = hdata.dwVolumeSerialNumber; |
449 | buf->st_ino = hdata.nFileIndexLow | | 447 | buf->st_ino = hdata.nFileIndexLow | |
450 | (((ino_t)hdata.nFileIndexHigh)<<32); | 448 | (((ino_t)hdata.nFileIndexHigh)<<32); |
451 | buf->st_nlink = S_ISDIR(buf->st_mode) ? 2 : hdata.nNumberOfLinks; | 449 | buf->st_nlink = S_ISDIR(buf->st_mode) ? 2 : hdata.nNumberOfLinks; |
452 | CloseHandle(fh); | ||
453 | } | ||
454 | else { | ||
455 | error: | ||
456 | errno = err_win_to_posix(GetLastError()); | ||
457 | CloseHandle(fh); | ||
458 | return -1; | ||
459 | } | 450 | } |
451 | CloseHandle(fh); | ||
460 | #endif | 452 | #endif |
461 | 453 | ||
462 | /* | 454 | /* |