aboutsummaryrefslogtreecommitdiff
path: root/src/cache_hash.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-04 21:26:50 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-04 21:26:50 -0500
commitf32f7a937fa7150aaba450b1282bba9f01918807 (patch)
treeecb462e15546a50b2e948b8f2907872dd39a2dc6 /src/cache_hash.cpp
parent1411df4e2705e677003e6e5b5cbe1ca30bf637d7 (diff)
parent8c6fa982cd0a02775264b616c37da9907cc603bb (diff)
downloadzig-f32f7a937fa7150aaba450b1282bba9f01918807.tar.gz
zig-f32f7a937fa7150aaba450b1282bba9f01918807.zip
Merge remote-tracking branch 'origin/master' into llvm8
Diffstat (limited to 'src/cache_hash.cpp')
-rw-r--r--src/cache_hash.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/cache_hash.cpp b/src/cache_hash.cpp
index 5e6c3b9a9d..4526a83c27 100644
--- a/src/cache_hash.cpp
+++ b/src/cache_hash.cpp
@@ -222,14 +222,9 @@ static Error populate_file_hash(CacheHash *ch, CacheHashFile *chf, Buf *contents
assert(chf->path != nullptr);
OsFile this_file;
- if ((err = os_file_open_r(chf->path, &this_file)))
+ if ((err = os_file_open_r(chf->path, &this_file, &chf->mtime)))
return err;
- if ((err = os_file_mtime(this_file, &chf->mtime))) {
- os_file_close(this_file);
- return err;
- }
-
if ((err = hash_file(chf->bin_digest, this_file, contents))) {
os_file_close(this_file);
return err;
@@ -351,17 +346,12 @@ Error cache_hit(CacheHash *ch, Buf *out_digest) {
// if the mtime matches we can trust the digest
OsFile this_file;
- if ((err = os_file_open_r(chf->path, &this_file))) {
+ OsTimeStamp actual_mtime;
+ if ((err = os_file_open_r(chf->path, &this_file, &actual_mtime))) {
fprintf(stderr, "Unable to open %s\n: %s", buf_ptr(chf->path), err_str(err));
os_file_close(ch->manifest_file);
return ErrorCacheUnavailable;
}
- OsTimeStamp actual_mtime;
- if ((err = os_file_mtime(this_file, &actual_mtime))) {
- os_file_close(this_file);
- os_file_close(ch->manifest_file);
- return err;
- }
if (chf->mtime.sec == actual_mtime.sec && chf->mtime.nsec == actual_mtime.nsec) {
os_file_close(this_file);
} else {