fix: ftell failure handling

This commit is contained in:
2026-05-16 13:26:40 +02:00
parent c68bebfd7c
commit ca3e523f93
+6
View File
@@ -47,6 +47,12 @@ bool file_update(File *file) {
// read file length
fseek(file_pointer, 0, SEEK_END);
length = ftell(file_pointer);
if (length == -1L) {
file->error = true;
fclose(file_pointer);
log_error("Cannot get file length for '%s'", file->path);
return false;
}
// init buffer
fseek(file_pointer, 0, SEEK_SET);
file->content = malloc(length + 1);