diff options
Diffstat (limited to 'lib/libstand')
-rw-r--r-- | lib/libstand/cd9660.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libstand/cd9660.c b/lib/libstand/cd9660.c index 621d30d..87ef6e9 100644 --- a/lib/libstand/cd9660.c +++ b/lib/libstand/cd9660.c @@ -262,11 +262,12 @@ buf_read_file(f, buf_p, size_p) size_t *size_p; { struct file *fp = (struct file *)f->f_fsdata; - daddr_t blkno; + daddr_t blkno, blkoff; int rc = 0; size_t read; blkno = fp->f_off / ISO_DEFAULT_BLOCK_SIZE + fp->f_bno; + blkoff = fp->f_off % ISO_DEFAULT_BLOCK_SIZE; if (blkno != fp->f_buf_blkno) { if (fp->f_buf == (char *)0) @@ -283,8 +284,8 @@ buf_read_file(f, buf_p, size_p) fp->f_buf_blkno = blkno; } - *buf_p = fp->f_buf + fp->f_off; - *size_p = ISO_DEFAULT_BLOCK_SIZE - fp->f_off; + *buf_p = fp->f_buf + blkoff; + *size_p = ISO_DEFAULT_BLOCK_SIZE - blkoff; if (*size_p > fp->f_size - fp->f_off) *size_p = fp->f_size - fp->f_off; |