summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/lseek.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-17 13:18:01 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-08-17 13:18:01 +0000
commitcc5c4ac6ddbc468a4083ccd5a9e1ab2aed409e64 (patch)
treec66a9fa52c4978107bc9764d27fe2f4bc6e2491b /cpukit/libcsupport/src/lseek.c
parentd62b0d5210ce1b55cc6d8470d8be541aa3061ff6 (diff)
downloadrtems-cc5c4ac6ddbc468a4083ccd5a9e1ab2aed409e64.tar.bz2
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.
Diffstat (limited to '')
-rw-r--r--cpukit/libcsupport/src/lseek.c5
1 files changed, 2 insertions, 3 deletions
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;
}