fix: ftell failure handling
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user