Skip to content

Commit f0b9800

Browse files
Fix fastfetch recaching every time if an old cache exists
1 parent be84549 commit f0b9800

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
cmake_minimum_required(VERSION 3.1.0) # Threads::Threads
22

33
project(fastfetch
4-
VERSION 1.1.0
4+
VERSION 1.1.1
55
LANGUAGES C
66
)
77

88
#e.g. +1
99
#This allows to track builds between versions, without GitHub creating a new release
10-
set(PROJECT_VERSION_EXTRA "+1")
10+
set(PROJECT_VERSION_EXTRA "")
1111

1212
include(GNUInstallDirs)
1313

src/common/io.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,10 @@ void ffCacheValidate(FFinstance* instance)
246246
ffStrbufInit(&content);
247247
ffAppendFileContent(path.chars, &content);
248248

249-
if(ffStrbufCompS(&content, FASTFETCH_PROJECT_VERSION) == 0)
249+
bool isSameVersion = ffStrbufCompS(&content, FASTFETCH_PROJECT_VERSION) == 0;
250+
ffStrbufDestroy(&content);
251+
if(isSameVersion)
250252
{
251-
ffStrbufDestroy(&content);
252253
ffStrbufDestroy(&path);
253254
return;
254255
}
@@ -261,7 +262,6 @@ void ffCacheValidate(FFinstance* instance)
261262
ffWriteFileContent(path.chars, &version);
262263
ffStrbufDestroy(&version);
263264

264-
ffStrbufDestroy(&content);
265265
ffStrbufDestroy(&path);
266266
}
267267

@@ -409,7 +409,7 @@ bool ffWriteFDContent(int fd, const FFstrbuf* content)
409409

410410
void ffWriteFileContent(const char* fileName, const FFstrbuf* content)
411411
{
412-
int fd = open(fileName, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
412+
int fd = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
413413
if(fd == -1)
414414
return;
415415

0 commit comments

Comments
 (0)