Noux: fix 'Vfs_io_channel::lseek()' calculations

With this patch the 'Vfs_io_channel::lseek()' function takes the offset
argument into account when calculating the new seek offset in the SEEK_CUR
and SEEK_END cases.

Fixes #352.
This commit is contained in:
Christian Prochaska 2012-09-10 18:04:59 +02:00 committed by Norman Feske
parent 4ab9782b8b
commit 4b81cf3e63

View File

@ -157,8 +157,12 @@ namespace Noux {
{
switch (sysio->lseek_in.whence) {
case Sysio::LSEEK_SET: _fh->_seek = sysio->lseek_in.offset; break;
case Sysio::LSEEK_CUR: break;
case Sysio::LSEEK_END: _fh->_seek = size(sysio); break;
case Sysio::LSEEK_CUR: _fh->_seek += sysio->lseek_in.offset; break;
case Sysio::LSEEK_END:
off_t offset = sysio->lseek_in.offset;
sysio->fstat_in.fd = sysio->lseek_in.fd;
_fh->_seek = size(sysio) + offset;
break;
}
sysio->lseek_out.offset = _fh->_seek;
return true;