Windows/Path.inc: Introduce file_type::character_file and file_type::fifo_file in...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 18 Jul 2013 17:00:54 +0000 (17:00 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Thu, 18 Jul 2013 17:00:54 +0000 (17:00 +0000)
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

lib/Support/Windows/Path.inc
test/Other/close-stderr.ll

index 0eb0759d7435538e2481ce959832adbf187fbbd6..5d951425384870f6fd1b5a9f782f7235c0d39a83 100644 (file)
@@ -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;
index 007ab0ea131a78e77ca7fc938a2124c642d2b945..6e180cd1d898fe622ae5635a79440e62cc3c6883 100644 (file)
@@ -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