This commit is contained in:
2025-09-13 18:29:56 +02:00
parent db2645a1b5
commit d2c18668eb
6 changed files with 65 additions and 15 deletions
+4
View File
@@ -4,6 +4,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include "logs.h"
#include "types.h"
time_t get_file_time(File file) {
@@ -23,6 +24,7 @@ void update_file(File *file) {
if (file->content != 0) {
free(file->content);
}
log_info("Reading '%s'...", file->path);
// init empty file
file->content = 0;
file->error = false;
@@ -31,6 +33,7 @@ void update_file(File *file) {
FILE *file_pointer = fopen(file->path, "rb");
if (!file_pointer) {
file->error = true;
log_error("Cannot open file '%s'", file->path);
return;
}
// read file length
@@ -42,6 +45,7 @@ void update_file(File *file) {
if (!file->content) {
file->error = true;
fclose(file_pointer);
log_error("Cannot read file '%s'", file->path);
return;
}
// read file