fixed some compiler warnings

This commit is contained in:
Linus Dierheimer
2021-02-22 17:14:46 +01:00
parent df3dcb7ede
commit 4b4f92eb74
5 changed files with 14 additions and 5 deletions
+2
View File
@@ -4,6 +4,8 @@ project(fastfetch)
include (${CMAKE_ROOT}/Modules/FindX11.cmake)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
add_executable(fastfetch
src/fastfetch.c
src/break.c
+9 -2
View File
@@ -103,7 +103,7 @@ void ffPrintError(FFstate* state, const char* key, const char* message)
printf(FASTFETCH_TEXT_MODIFIER_ERROR"%s\n"FASTFETCH_TEXT_MODIFIER_RESET, message);
}
static bool getCacheFileName(FFstate* state, const char* key, char* buffer)
static void getCacheFileName(FFstate* state, const char* key, char* buffer)
{
const char* xdgCache = getenv("XDG_CACHE_HOME");
if(xdgCache == NULL)
@@ -146,6 +146,8 @@ bool ffPrintCachedValue(FFstate* state, const char* key)
ffPrintLogoAndKey(state, key);
puts(value);
return true;
}
void ffSaveCachedValue(FFstate* state, const char* key, const char* value)
@@ -157,9 +159,14 @@ void ffSaveCachedValue(FFstate* state, const char* key, const char* value)
if(fd == -1)
return;
write(fd, value, strlen(value));
size_t len = strlen(value);
bool failed = write(fd, value, len) != len;
close(fd);
if(failed)
unlink(fileName);
}
static void printHelp()
+1 -1
View File
@@ -35,7 +35,7 @@ void ffPrintFont(FFstate* state)
char gtk3Pretty[256];
if(gtk3[0] == '\0')
gtk3Pretty[0]== '\0';
gtk3Pretty[0] = '\0';
else
parseFont(gtk3, gtk3Pretty);
+1 -1
View File
@@ -27,7 +27,7 @@ void ffPrintHost(FFstate* state)
{
ssize_t len = strlen(host);
host[len] = ' ';
fscanf(versionFile, "%[^\n]", host + len + 1);
if(fscanf(versionFile, "%[^\n]", host + len + 1) == 0); //fail silently, if reading of version fails, just show now version
fclose(versionFile);
}
+1 -1
View File
@@ -10,7 +10,7 @@ void printTerminalName(FFstate* state, const char* pid)
FILE* stat = fopen(file, "r");
if(stat == NULL)
{
char error[256];
char error[300];
sprintf(error, "fopen(\"%s\", \"r\") == NULL", file);
ffPrintError(state, "Terminal", error);
return;