From 47901d84b3fb3119c2baf96a71fbe7158a7d5d7c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 8 Nov 2001 00:24:55 +0000 Subject: 2001-11-07 Jennifer Averett Reported by Ibragimov Ilya and tracked as PR49. * src/imfs/imfs_directory.c: Do not calculate the offset twice. --- c/src/exec/libfs/ChangeLog | 5 +++++ c/src/exec/libfs/src/imfs/imfs_directory.c | 12 ++---------- c/src/libfs/ChangeLog | 5 +++++ c/src/libfs/src/imfs/imfs_directory.c | 12 ++---------- cpukit/libfs/ChangeLog | 5 +++++ cpukit/libfs/src/imfs/imfs_directory.c | 12 ++---------- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/c/src/exec/libfs/ChangeLog b/c/src/exec/libfs/ChangeLog index 2d8563c468..a9e883da45 100644 --- a/c/src/exec/libfs/ChangeLog +++ b/c/src/exec/libfs/ChangeLog @@ -1,3 +1,8 @@ +2001-11-07 Jennifer Averett + + Reported by Ibragimov Ilya and tracked as PR49. + * src/imfs/imfs_directory.c: Do not calculate the offset twice. + 2001-10-26 Victor V. Vengerov * src/imfs/imfs_load_tar.c: Minor modification so this will diff --git a/c/src/exec/libfs/src/imfs/imfs_directory.c b/c/src/exec/libfs/src/imfs/imfs_directory.c index fc9d44828d..9df4543909 100644 --- a/c/src/exec/libfs/src/imfs/imfs_directory.c +++ b/c/src/exec/libfs/src/imfs/imfs_directory.c @@ -187,18 +187,11 @@ int imfs_dir_lseek( int whence ) { - off_t normal_offset; - - normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); - - switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ - iop->offset = normal_offset; - break; - case SEEK_CUR: /* relative move */ - iop->offset = iop->offset + normal_offset; + iop->offset = (iop->offset/sizeof(struct dirent)) * + sizeof(struct dirent); break; case SEEK_END: /* Movement past the end of the directory via lseek */ @@ -206,7 +199,6 @@ int imfs_dir_lseek( default: set_errno_and_return_minus_one( EINVAL ); break; - } return 0; diff --git a/c/src/libfs/ChangeLog b/c/src/libfs/ChangeLog index 2d8563c468..a9e883da45 100644 --- a/c/src/libfs/ChangeLog +++ b/c/src/libfs/ChangeLog @@ -1,3 +1,8 @@ +2001-11-07 Jennifer Averett + + Reported by Ibragimov Ilya and tracked as PR49. + * src/imfs/imfs_directory.c: Do not calculate the offset twice. + 2001-10-26 Victor V. Vengerov * src/imfs/imfs_load_tar.c: Minor modification so this will diff --git a/c/src/libfs/src/imfs/imfs_directory.c b/c/src/libfs/src/imfs/imfs_directory.c index fc9d44828d..9df4543909 100644 --- a/c/src/libfs/src/imfs/imfs_directory.c +++ b/c/src/libfs/src/imfs/imfs_directory.c @@ -187,18 +187,11 @@ int imfs_dir_lseek( int whence ) { - off_t normal_offset; - - normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); - - switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ - iop->offset = normal_offset; - break; - case SEEK_CUR: /* relative move */ - iop->offset = iop->offset + normal_offset; + iop->offset = (iop->offset/sizeof(struct dirent)) * + sizeof(struct dirent); break; case SEEK_END: /* Movement past the end of the directory via lseek */ @@ -206,7 +199,6 @@ int imfs_dir_lseek( default: set_errno_and_return_minus_one( EINVAL ); break; - } return 0; diff --git a/cpukit/libfs/ChangeLog b/cpukit/libfs/ChangeLog index 2d8563c468..a9e883da45 100644 --- a/cpukit/libfs/ChangeLog +++ b/cpukit/libfs/ChangeLog @@ -1,3 +1,8 @@ +2001-11-07 Jennifer Averett + + Reported by Ibragimov Ilya and tracked as PR49. + * src/imfs/imfs_directory.c: Do not calculate the offset twice. + 2001-10-26 Victor V. Vengerov * src/imfs/imfs_load_tar.c: Minor modification so this will diff --git a/cpukit/libfs/src/imfs/imfs_directory.c b/cpukit/libfs/src/imfs/imfs_directory.c index fc9d44828d..9df4543909 100644 --- a/cpukit/libfs/src/imfs/imfs_directory.c +++ b/cpukit/libfs/src/imfs/imfs_directory.c @@ -187,18 +187,11 @@ int imfs_dir_lseek( int whence ) { - off_t normal_offset; - - normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); - - switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ - iop->offset = normal_offset; - break; - case SEEK_CUR: /* relative move */ - iop->offset = iop->offset + normal_offset; + iop->offset = (iop->offset/sizeof(struct dirent)) * + sizeof(struct dirent); break; case SEEK_END: /* Movement past the end of the directory via lseek */ @@ -206,7 +199,6 @@ int imfs_dir_lseek( default: set_errno_and_return_minus_one( EINVAL ); break; - } return 0; -- cgit v1.2.3