aboutsummaryrefslogtreecommitdiff
path: root/ninja.cc
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-15 16:01:16 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-10-15 16:01:16 +0900
commit6ce977d00542b689fae703311faca1766e30b286 (patch)
treee3f5a665c444ec0b855b90e9740da1cfba4b7527 /ninja.cc
parent9c5ec1d44238c033ab9cac37e56833447c422338 (diff)
[C++] Regenerate ninja files when symlink was changed
Diffstat (limited to 'ninja.cc')
-rw-r--r--ninja.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/ninja.cc b/ninja.cc
index 9c85815..21c935f 100644
--- a/ninja.cc
+++ b/ninja.cc
@@ -931,8 +931,21 @@ bool NeedsRegen(double start_time, const string& orig_args) {
// directory which affects the results of find command.
if (s == "" || s == "." || ShouldIgnoreDirty(s))
continue;
- double ts = GetTimestamp(s);
- should_run_command |= (ts < 0 || gen_time < ts);
+
+ struct stat st;
+ if (lstat(s.c_str(), &st) != 0) {
+ should_run_command = true;
+ continue;
+ }
+ double ts = GetTimestampFromStat(st);
+ if (gen_time < ts) {
+ should_run_command = true;
+ continue;
+ }
+ if (S_ISLNK(st.st_mode)) {
+ ts = GetTimestamp(s);
+ should_run_command |= (ts < 0 || gen_time < ts);
+ }
}
if (!should_run_command) {