summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/lseek.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cpukit/libcsupport/src/lseek.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cpukit/libcsupport/src/lseek.c b/cpukit/libcsupport/src/lseek.c
index 514f8cd912..cd8046356f 100644
--- a/cpukit/libcsupport/src/lseek.c
+++ b/cpukit/libcsupport/src/lseek.c
@@ -24,15 +24,19 @@ off_t lseek(
{
rtems_libio_t *iop;
+ rtems_libio_check_fd( fd );
+ iop = rtems_libio_iop( fd );
+
/*
* If this file descriptor is mapped to an external set of handlers,
* then pass the request on to them.
*/
- if ( rtems_file_descriptor_type( fd ) ) {
+ if ( iop->flags & LIBIO_FLAGS_HANDLER_MASK ) {
rtems_libio_lseek_t fp;
- fp = rtems_libio_handlers[rtems_file_descriptor_type_index(fd)].lseek;
+ fp = rtems_libio_handlers[
+ (iop->flags >> LIBIO_FLAGS_HANDLER_SHIFT) - 1].lseek;
if ( fp == NULL )
set_errno_and_return_minus_one( EBADF );
@@ -43,9 +47,6 @@ off_t lseek(
* Now process the lseek().
*/
- iop = rtems_libio_iop( fd );
- rtems_libio_check_fd( fd );
-
switch ( whence ) {
case SEEK_SET:
iop->offset = offset;