-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Hi,
Nice work, I never user FUSE before, anyway the truncate function in vmram.cpp does:
file->size(size);
And it it's just nice for this function to delegate the class, anyway the file function size() in file class:
void file_t::size(size_t new_size) {
if (new_size < _size) {
free_blocks(new_size);
}
_size = new_size;
mtime(util::time());
}
Suppose you are using the standard shell command truncate on a new file or to increase the size of any existing one, as you only check the new size is less the _size member field you will finally get the new or bigger "truncated" file without the correct blocks allocated. So then, when using the file again, you will get a segfault. Try by yourself.
Is it solution writing a while loop to allocate all the blocks needed with alloc_block function?
Regards Massimo.
LHLaurini
Metadata
Metadata
Assignees
Labels
No labels