forked from Imagelibrary/rtems
2001-08-16 Joel Sherrill <joel@OARcorp.com>
* libc/lseek.c: Modified after discussion with Eugeny S. Mints <jack@oktet.ru> to correct the behavior. There were two mistakes. First, iop->offset was incorrectly set for SEEK_END. Second, iop->offset should be left unmodified if there are errors. This modification attempts to fix both situations.
This commit is contained in:
@@ -68,14 +68,13 @@ off_t lseek(
|
||||
*/
|
||||
|
||||
status = (*iop->handlers->lseek_h)( iop, offset, whence );
|
||||
if ( !status )
|
||||
return 0;
|
||||
if ( status == (off_t) -1 )
|
||||
iop->offset = old_offset;
|
||||
|
||||
/*
|
||||
* So if the operation failed, we have to restore iop->offset.
|
||||
*/
|
||||
|
||||
iop->offset = old_offset;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,13 @@ off_t lseek(
|
||||
*/
|
||||
|
||||
status = (*iop->handlers->lseek_h)( iop, offset, whence );
|
||||
if ( !status )
|
||||
return 0;
|
||||
if ( status == (off_t) -1 )
|
||||
iop->offset = old_offset;
|
||||
|
||||
/*
|
||||
* So if the operation failed, we have to restore iop->offset.
|
||||
*/
|
||||
|
||||
iop->offset = old_offset;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,13 @@ off_t lseek(
|
||||
*/
|
||||
|
||||
status = (*iop->handlers->lseek_h)( iop, offset, whence );
|
||||
if ( !status )
|
||||
return 0;
|
||||
if ( status == (off_t) -1 )
|
||||
iop->offset = old_offset;
|
||||
|
||||
/*
|
||||
* So if the operation failed, we have to restore iop->offset.
|
||||
*/
|
||||
|
||||
iop->offset = old_offset;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user