mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
fixed a bug in caching
This commit is contained in:
+9
-4
@@ -138,21 +138,26 @@ bool ffPrintCachedValue(FFstate* state, const char* key)
|
||||
return false;
|
||||
|
||||
char value[1024];
|
||||
if(read(fd, value, sizeof(value) - 1) < 1)
|
||||
|
||||
ssize_t readed = read(fd, value, sizeof(value) - 1);
|
||||
if(readed < 1)
|
||||
return false;
|
||||
|
||||
value[1023] = '\n'; //Ensure that we end with a newline, even when we didn't fully read the file
|
||||
|
||||
close(fd);
|
||||
|
||||
value[readed] = '\0'; //Somehow read doesn't alway do this
|
||||
|
||||
ffPrintLogoAndKey(state, key);
|
||||
puts(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffSaveCachedValue(FFstate* state, const char* key, const char* value)
|
||||
void ffPrintAndSaveCachedValue(FFstate* state, const char* key, const char* value)
|
||||
{
|
||||
ffPrintLogoAndKey(state, key);
|
||||
puts(value);
|
||||
|
||||
char fileName[256];
|
||||
getCacheFileName(state, key, fileName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user