From cc5c4ac6ddbc468a4083ccd5a9e1ab2aed409e64 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 Aug 2001 13:18:01 +0000 Subject: 2001-08-16 Joel Sherrill * libc/lseek.c: Modified after discussion with Eugeny S. Mints 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. --- cpukit/libcsupport/src/lseek.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cpukit') diff --git a/cpukit/libcsupport/src/lseek.c b/cpukit/libcsupport/src/lseek.c index 910b81d231..af41116346 100644 --- a/cpukit/libcsupport/src/lseek.c +++ b/cpukit/libcsupport/src/lseek.c @@ -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; } -- cgit v1.2.3