From 770f6e99fb77a3fded02f0ad7682531a9bc7b6ed Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 Aug 2001 13:17:04 +0000 Subject: 2001-08-17 Joel Sherrill * libc/lseek.c: Fix minor bug introduced by misinterpretation of return code. --- c/src/lib/libc/lseek.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/c/src/lib/libc/lseek.c b/c/src/lib/libc/lseek.c index 54c7dddc77..af41116346 100644 --- a/c/src/lib/libc/lseek.c +++ b/c/src/lib/libc/lseek.c @@ -11,9 +11,13 @@ * $Id$ */ +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include -#include "libio_.h" +#include off_t lseek( int fd, @@ -33,7 +37,7 @@ off_t lseek( * Check as many errors as possible before touching iop->offset. */ - if ( !iop->handlers->lseek ) + if ( !iop->handlers->lseek_h ) set_errno_and_return_minus_one( ENOTSUP ); /* @@ -63,15 +67,14 @@ off_t lseek( * new offset. */ - status = (*iop->handlers->lseek)( iop, offset, whence ); - if ( !status ) - return 0; + status = (*iop->handlers->lseek_h)( iop, offset, whence ); + 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