diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-08-04 11:13:57 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-08-05 10:47:37 +0200 |
commit | 9c4113f0c78d0872e1f5691e40a19f620a98cfec (patch) | |
tree | a3fe765841c8927eec6b0a4e4029a01808ba76a0 /winsup/cygwin/path.cc | |
parent | 99a3f266c15af5bbb9a8cacda63ce11b094c10d1 (diff) | |
download | cygnal-9c4113f0c78d0872e1f5691e40a19f620a98cfec.tar.gz cygnal-9c4113f0c78d0872e1f5691e40a19f620a98cfec.tar.bz2 cygnal-9c4113f0c78d0872e1f5691e40a19f620a98cfec.zip |
Workaround for filesystems with broken FileAllInformation info class (NcFsd)
See discussion starting at https://cygwin.com/ml/cygwin/2016-07/msg00350.html
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 970a0fec4..4ffe5f9bd 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1305,8 +1305,31 @@ file_get_fai (HANDLE h, PFILE_ALL_INFORMATION pfai) /* Some FSes (Netapps) don't implement FileNetworkOpenInformation. */ status = NtQueryInformationFile (h, &io, pfai, sizeof *pfai, FileAllInformation); - if (status == STATUS_BUFFER_OVERFLOW) + if (likely (status == STATUS_BUFFER_OVERFLOW)) status = STATUS_SUCCESS; + /* Filesystems with broken FileAllInformation exist, too. See the thread + starting with https://cygwin.com/ml/cygwin/2016-07/msg00350.html. */ + else if (!NT_SUCCESS (status) && status != STATUS_ACCESS_DENIED) + { + memset (pfai, 0, sizeof *pfai); + status = NtQueryInformationFile (h, &io, &pfai->BasicInformation, + sizeof pfai->BasicInformation, + FileBasicInformation); + if (NT_SUCCESS (status)) + { + /* The return value of FileInternalInformation is largely ignored. + We only make absolutely sure the inode number is set to 0 in + case it fails. */ + status = NtQueryInformationFile (h, &io, &pfai->InternalInformation, + sizeof pfai->InternalInformation, + FileInternalInformation); + if (!NT_SUCCESS (status)) + pfai->InternalInformation.IndexNumber.QuadPart = 0LL; + status = NtQueryInformationFile (h, &io, &pfai->StandardInformation, + sizeof pfai->StandardInformation, + FileStandardInformation); + } + } return status; } |