summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-17 13:17:04 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-17 13:17:04 +0000
commit770f6e99fb77a3fded02f0ad7682531a9bc7b6ed (patch)
tree9527bb2f7e289894a6468e2d866f9162cde04325
parent2001-08-16 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-770f6e99fb77a3fded02f0ad7682531a9bc7b6ed.tar.bz2
2001-08-17 Joel Sherrill <joel@OARcorp.com>
* libc/lseek.c: Fix minor bug introduced by misinterpretation of return code.
-rw-r--r--c/src/lib/libc/lseek.c15
1 files 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 <stdio.h>
-#include "libio_.h"
+#include <rtems/libio_.h>
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;
}