diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-02-09 10:53:16 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-02-09 11:05:18 +0100 |
commit | e303adf4445919d4d87e8467854c404f9bd0d076 (patch) | |
tree | 5b98af999c6e135b4a4ec1370f8922a7afb5bc5f /cpukit/libfs/src/dosfs/msdos_dir.c | |
parent | Fixed warnings and minor bugs (diff) | |
download | rtems-e303adf4445919d4d87e8467854c404f9bd0d076.tar.bz2 |
Check that the file offset is valid after a seek
Diffstat (limited to 'cpukit/libfs/src/dosfs/msdos_dir.c')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_dir.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_dir.c b/cpukit/libfs/src/dosfs/msdos_dir.c index 9a8ed1e54e..a0ef507392 100644 --- a/cpukit/libfs/src/dosfs/msdos_dir.c +++ b/cpukit/libfs/src/dosfs/msdos_dir.c @@ -500,21 +500,11 @@ msdos_dir_read(rtems_libio_t *iop, void *buffer, size_t count) off_t msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence) { - switch (whence) - { - case SEEK_SET: - case SEEK_CUR: - break; - /* - * Movement past the end of the directory via lseek is not a - * permitted operation - */ - case SEEK_END: - default: - rtems_set_errno_and_return_minus_one( EINVAL ); - break; + if (iop->offset >= 0 && iop->offset <= iop->size) { + return 0; + } else { + rtems_set_errno_and_return_minus_one(EINVAL); } - return RC_OK; } /* msdos_dir_stat -- |