[rtems commit] fstests/fsfseeko01: Fix for long == off_t

Sebastian Huber sebh at rtems.org
Wed Apr 8 05:46:50 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Apr  8 07:46:10 2015 +0200

fstests/fsfseeko01: Fix for long == off_t

Close #2317.

---

 testsuites/fstests/fsfseeko01/init.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/testsuites/fstests/fsfseeko01/init.c b/testsuites/fstests/fsfseeko01/init.c
index ef92d10..dd073ce 100644
--- a/testsuites/fstests/fsfseeko01/init.c
+++ b/testsuites/fstests/fsfseeko01/init.c
@@ -62,10 +62,17 @@ static void test(void)
   rtems_test_assert(rv == 0);
   rtems_test_assert(errno == 0);
 
-  errno = 0;
-  actual_long_off = ftell(file);
-  rtems_test_assert(actual_long_off == -1L);
-  rtems_test_assert(errno == EOVERFLOW);
+  if (sizeof(off_t) == sizeof(long)) {
+    errno = 0;
+    actual_long_off = ftell(file);
+    rtems_test_assert(actual_long_off == off);
+    rtems_test_assert(errno == 0);
+  } else {
+    errno = 0;
+    actual_long_off = ftell(file);
+    rtems_test_assert(actual_long_off == -1L);
+    rtems_test_assert(errno == EOVERFLOW);
+  }
 
   errno = 0;
   actual_off = ftello(file);



More information about the vc mailing list