summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-09-20 08:54:32 +1000
committerTimothy Arceri <[email protected]>2018-10-02 22:07:55 +1000
commitea66bfda8801a0f5139c8e4655373117cdd7a1c0 (patch)
tree919e789f97f8084d904d1f1c8de70995a1f22271 /src/util
parent0bdf7b1d0fb957f69f2c3518399db17d59c5f183 (diff)
util: disable cache if we have no build-id and timestamp is zero
Timestamp can be zero for example when Flatpak is used. In this case just disable the cache rather then segfaulting when incompatible cache items are loaded. V2: actually return false when mtime is 0. Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/disk_cache.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/disk_cache.h b/src/util/disk_cache.h
index 50bd9f41ac4..c8685a53ed3 100644
--- a/src/util/disk_cache.h
+++ b/src/util/disk_cache.h
@@ -26,6 +26,7 @@
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
+#include <stdio.h>
#endif
#include <assert.h>
#include <stdint.h>
@@ -100,7 +101,15 @@ disk_cache_get_function_timestamp(void *ptr, uint32_t* timestamp)
if (stat(info.dli_fname, &st)) {
return false;
}
+
+ if (!st.st_mtime) {
+ fprintf(stderr, "Mesa: The provided filesystem timestamp for the cache "
+ "is bogus! Disabling On-disk cache.\n");
+ return false;
+ }
+
*timestamp = st.st_mtime;
+
return true;
}
#endif