summaryrefslogtreecommitdiff
path: root/src/build_helper
diff options
context:
space:
mode:
authorNikolay Merinov <nikolay.merinov@member.fsf.org>2017-12-01 14:28:14 +0500
committerNikolay Merinov <nikolay.merinov@member.fsf.org>2017-12-01 14:55:02 +0500
commitf2df1f5ec6648713791c07b5ca79fa4da87b7d74 (patch)
treec7bff1c0cdda6de1d91984d42b4d5b41564b91b3 /src/build_helper
parent804b15be82ea668d943fab70195eb57a2f942d4b (diff)
downloadrust-f2df1f5ec6648713791c07b5ca79fa4da87b7d74.tar.gz
build_helper: destination file can't be up to date when not exists
Function "up_to_date" return incorrect result if mtime for all fetched sources is set to epoch time. Add existence check to function.
Diffstat (limited to 'src/build_helper')
-rw-r--r--src/build_helper/lib.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs
index 97723e260f6..2b6e2828cfb 100644
--- a/src/build_helper/lib.rs
+++ b/src/build_helper/lib.rs
@@ -190,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
///
/// Uses last-modified time checks to verify this.
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
+ if !dst.exists() {
+ return false;
+ }
let threshold = mtime(dst);
let meta = match fs::metadata(src) {
Ok(meta) => meta,