OSDN Git Service

[Solaris] Fix PR33228 - llvm::sys::fs::is_local_impl done right
authorKamil Rytarowski <n54@gmx.com>
Thu, 1 Jun 2017 12:57:00 +0000 (12:57 +0000)
committerKamil Rytarowski <n54@gmx.com>
Thu, 1 Jun 2017 12:57:00 +0000 (12:57 +0000)
Summary:
Solaris-specific implementation for llvm::sys::fs::is_local_impl.
FStype pattern matching might be a bit unreliable, but at least it fixes the build failure.

Reviewers: mgorny, nlopes, llvm-commits, krytarowski

Reviewed By: krytarowski

Subscribers: voskresensky.vladimir, krytarowski

Differential Revision: https://reviews.llvm.org/D33695

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304412 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Unix/Path.inc

index fa28ba1..ce638d4 100644 (file)
@@ -381,6 +381,11 @@ static bool is_local_impl(struct STATVFS &Vfs) {
 #elif defined(__CYGWIN__)
   // Cygwin doesn't expose this information; would need to use Win32 API.
   return false;
+#elif defined(__sun)
+  // statvfs::f_basetype contains a null-terminated FSType name of the mounted target
+  StringRef fstype(Vfs.f_basetype);
+  // NFS is the only non-local fstype??
+  return !fstype.equals("nfs");
 #else
   return !!(STATVFS_F_FLAG(Vfs) & MNT_LOCAL);
 #endif