diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 0eb0759d743..5d951425384 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -579,6 +579,19 @@ static error_code getStatus(HANDLE FileHandle, file_status &Result) { if (FileHandle == INVALID_HANDLE_VALUE) goto handle_status_error; + switch (::GetFileType(FileHandle)) { + default: + case FILE_TYPE_UNKNOWN: + case FILE_TYPE_DISK: + break; + case FILE_TYPE_CHAR: + Result = file_status(file_type::character_file); + return error_code::success(); + case FILE_TYPE_PIPE: + Result = file_status(file_type::fifo_file); + return error_code::success(); + } + BY_HANDLE_FILE_INFORMATION Info; if (!::GetFileInformationByHandle(FileHandle, &Info)) goto handle_status_error; diff --git a/test/Other/close-stderr.ll b/test/Other/close-stderr.ll index 007ab0ea131..6e180cd1d89 100644 --- a/test/Other/close-stderr.ll +++ b/test/Other/close-stderr.ll @@ -9,9 +9,6 @@ ; XFAIL: vg_leak ; REQUIRES: shell -; FIXME: sys::fs::status() doesn't work on pipes, since r186560. -; XFAIL: mingw32 - ; opt will fail to open /dev/null on native win32. ; XFAIL: win32