mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Packages: don't cache values if we fail to acquire modify time
This commit is contained in:
@@ -32,6 +32,9 @@ bool ffPackagesReadCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, const char*
|
||||
return true;
|
||||
}
|
||||
|
||||
if (__builtin_expect(st.st_mtim.tv_sec <= 0, false))
|
||||
return false;
|
||||
|
||||
uint64_t mtime_current = (uint64_t) st.st_mtim.tv_sec * 1000 + (uint64_t) st.st_mtim.tv_nsec / 1000000;
|
||||
|
||||
ffStrbufSet(cacheDir, &instance.state.platform.cacheDir);
|
||||
@@ -57,6 +60,9 @@ bool ffPackagesReadCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, const char*
|
||||
|
||||
bool ffPackagesWriteCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, uint32_t num_elements)
|
||||
{
|
||||
if (__builtin_expect(cacheContent->length == 0, false))
|
||||
return false;
|
||||
|
||||
ffStrbufAppendF(cacheContent, "%" PRIu32, num_elements);
|
||||
return ffWriteFileBuffer(cacheDir->chars, cacheContent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user