diff --git a/fs/initrd.c b/fs/initrd.c index 8f6067da..99b19669 100644 --- a/fs/initrd.c +++ b/fs/initrd.c @@ -50,12 +50,16 @@ typedef struct { static ssize_t initrd_read(vfs_node_t* node, uint8_t* buffer, size_t size, off_t offset) { - uint32_t i, pos, found = 0; + uint32_t i, pos = 0, found = 0; char* data = NULL; block_list_t* blist = &node->block_list; /* searching for the valid data block */ - pos = offset ? node->block_size / offset : 0; + if (offset) { + pos = offset / node->block_size; + offset = offset % node->block_size; + } + do { for(i=0; idata[i]) {