From 98769944c897e69a7483f20a409aed89733e3c16 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 19 Jan 2011 17:12:20 +0000 Subject: [PATCH] - remove bug in initrd_read => fix the using of the argument "offset" git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@377 315a16e6-25f9-4109-90ae-ca3045a26c18 --- fs/initrd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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]) {