summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/disk_interface.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc
index 4e10f4e..6a14069 100644
--- a/src/disk_interface.cc
+++ b/src/disk_interface.cc
@@ -67,6 +67,12 @@ bool DiskInterface::MakeDirs(const string& path) {
TimeStamp RealDiskInterface::Stat(const string& path) {
#ifdef _WIN32
+ // MSDN: "Naming Files, Paths, and Namespaces"
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
+ if (!path.empty() && path[0] != '\\' && path.size() > MAX_PATH) {
+ Error("Stat(%s): Filename longer than %i characters", path.c_str(), MAX_PATH);
+ return -1;
+ }
_WIN32_FILE_ATTRIBUTE_DATA attrs;
if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attrs)) {
DWORD err = GetLastError();