[rtems commit] Filesystem: Avoid usage of uninitialized variable

Sebastian Huber sebh at rtems.org
Fri Aug 23 08:00:49 UTC 2013


Module:    rtems
Branch:    master
Commit:    630365b927f66787612326b187a276fafce52c89
Changeset: http://git.rtems.org/rtems/commit/?id=630365b927f66787612326b187a276fafce52c89

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Aug 23 09:43:53 2013 +0200

Filesystem: Avoid usage of uninitialized variable

This is a cosmetic fix.  There was no bug.

---

 cpukit/libfs/src/defaults/default_lseek_file.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libfs/src/defaults/default_lseek_file.c b/cpukit/libfs/src/defaults/default_lseek_file.c
index cafc4dc..1b05d92 100644
--- a/cpukit/libfs/src/defaults/default_lseek_file.c
+++ b/cpukit/libfs/src/defaults/default_lseek_file.c
@@ -33,7 +33,6 @@ off_t rtems_filesystem_default_lseek_file(
 {
   off_t rv = 0;
   off_t reference_offset;
-  off_t new_offset;
   struct stat st;
 
   switch ( whence ) {
@@ -53,9 +52,10 @@ off_t rtems_filesystem_default_lseek_file(
       rv = -1;
       break;
   }
-  new_offset = reference_offset + offset;
 
   if ( rv == 0 ) {
+    off_t new_offset = reference_offset + offset;
+
     if (
       (offset >= 0 && new_offset >= reference_offset)
         || (offset < 0 && new_offset < reference_offset)




More information about the vc mailing list