summaryrefslogtreecommitdiffstats
path: root/src/disk_interface.cc
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2012-03-05 01:45:04 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2012-03-07 23:11:17 (GMT)
commit1d25f6b54773c739340361902b7d1412f53ef7fc (patch)
treeec6be3e6812bce1ff6241a3cff4bdd5e57ee7c25 /src/disk_interface.cc
parent2338d9340bb2c13746805b4b878c889008850962 (diff)
downloadNinja-1d25f6b54773c739340361902b7d1412f53ef7fc.zip
Ninja-1d25f6b54773c739340361902b7d1412f53ef7fc.tar.gz
Ninja-1d25f6b54773c739340361902b7d1412f53ef7fc.tar.bz2
Treat paths of the form "existing-file/something" as non-existent
Some people like to construct phony target names by appending a "/something" suffix to an existing target "foo". But if "foo" is an existing file, stat will report ENOTDIR for this path, causing ninja to spew errors. Fix this by treating ENOTDIR in the same way as we do ENOENT -- as a non-existent path.
Diffstat (limited to 'src/disk_interface.cc')
-rw-r--r--src/disk_interface.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc
index 96a1e59..b1a1746 100644
--- a/src/disk_interface.cc
+++ b/src/disk_interface.cc
@@ -94,7 +94,7 @@ TimeStamp RealDiskInterface::Stat(const string& path) {
#else
struct stat st;
if (stat(path.c_str(), &st) < 0) {
- if (errno == ENOENT)
+ if (errno == ENOENT || errno == ENOTDIR)
return 0;
Error("stat(%s): %s", path.c_str(), strerror(errno));
return -1;