summaryrefslogtreecommitdiffstats
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
parentchanged version to ss-20010816 (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.
-rw-r--r--c/src/exec/libcsupport/src/lseek.c5
-rw-r--r--c/src/lib/libc/lseek.c5
-rw-r--r--cpukit/libcsupport/src/lseek.c5
3 files changed, 6 insertions, 9 deletions
diff --git a/c/src/exec/libcsupport/src/lseek.c b/c/src/exec/libcsupport/src/lseek.c
index 910b81d231..af41116346 100644
--- a/c/src/exec/libcsupport/src/lseek.c
+++ b/c/src/exec/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;
}
diff --git a/c/src/lib/libc/lseek.c b/c/src/lib/libc/lseek.c
index 910b81d231..af41116346 100644
--- a/c/src/lib/libc/lseek.c
+++ b/c/src/lib/libc/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;
}
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;
}