[libcxx] r273088 - Use utimes instead of utimensat when !defined(UTIME_OMIT). Fixes build for older GLIBC versions

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 18 10:37:04 PDT 2016


Author: ericwf
Date: Sat Jun 18 12:37:04 2016
New Revision: 273088

URL: http://llvm.org/viewvc/llvm-project?rev=273088&view=rev
Log:
Use utimes instead of utimensat when !defined(UTIME_OMIT). Fixes build for older GLIBC versions

Modified:
    libcxx/trunk/src/experimental/filesystem/operations.cpp

Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=273088&r1=273087&r2=273088&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/operations.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sat Jun 18 12:37:04 2016
@@ -507,8 +507,10 @@ void __last_write_time(const path& p, fi
     using namespace std::chrono;
     std::error_code m_ec;
 
-#if defined(__APPLE__)
+    // We can use the presence of UTIME_OMIT to detect GLIBC versions that
+    // do not provide utimensat.
     // FIXME: Use utimensat when it becomes available on OS X.
+#if defined(__APPLE__) || !defined(UTIME_OMIT)
     // This implementation has a race condition between determining the
     // last access time and attempting to set it to the same value using
     // ::utimes




More information about the cfe-commits mailing list