summaryrefslogtreecommitdiff
path: root/lib/sqfs/dir_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/dir_reader.c')
-rw-r--r--lib/sqfs/dir_reader.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqfs/dir_reader.c b/lib/sqfs/dir_reader.c
index 65962d8..e6467ef 100644
--- a/lib/sqfs/dir_reader.c
+++ b/lib/sqfs/dir_reader.c
@@ -145,15 +145,15 @@ int sqfs_dir_reader_open_dir(sqfs_dir_reader_t *rd,
rd->size = size;
rd->entries = 0;
- if (rd->size <= sizeof(rd->hdr))
- return 0;
-
block_start += rd->super->directory_table_start;
rd->dir_block_start = block_start;
rd->dir_offset = offset;
rd->start_size = size;
+ if (rd->size <= sizeof(rd->hdr))
+ return 0;
+
return sqfs_meta_reader_seek(rd->meta_dir, block_start, offset);
}
@@ -200,6 +200,9 @@ int sqfs_dir_reader_rewind(sqfs_dir_reader_t *rd)
rd->size = rd->start_size;
rd->entries = 0;
+ if (rd->size <= sizeof(rd->hdr))
+ return 0;
+
return sqfs_meta_reader_seek(rd->meta_dir, rd->dir_block_start,
rd->dir_offset);
}