summaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2013-07-18 17:00:54 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2013-07-18 17:00:54 +0000
commit2cf5425d0a048fbf36fc15035487f427499b514a (patch)
tree5484a77c69ec4bfdc94e7be92b89cf3e6e8d6f62 /lib/Support/Windows/Path.inc
parent431b0a7646105c53c607cbf0015c615269bc5f11 (diff)
Windows/Path.inc: Introduce file_type::character_file and file_type::fifo_file in sys::fs::getStatus(HANDLE).
It fixes llvm/test/Other/close-stderr.ll on msys. FIXME: Provide unittests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186588 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r--lib/Support/Windows/Path.inc13
1 files changed, 13 insertions, 0 deletions
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;