[rtems commit] psxtests/psxfile01: Fix according to POSIX

Sebastian Huber sebh at rtems.org
Fri Sep 13 15:00:50 UTC 2013


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 13 17:06:06 2013 +0200

psxtests/psxfile01: Fix according to POSIX

ftruncate() and open() with O_TRUNC shall upon successful completion
mark for update the st_ctime and st_mtime fields of the file.

truncate() shall upon successful completion, if the file size is
changed, mark for update the st_ctime and st_mtime fields of the file.

The POSIX standard "The Open Group Base Specifications Issue 7", IEEE
Std 1003.1, 2013 Edition says nothing about the behaviour of truncate()
if the file size remains unchanged.

Future directions of the standard may mandate the behaviour specified in
ftruncate():

http://austingroupbugs.net/view.php?id=489

---

 testsuites/psxtests/psxfile01/test.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c
index 4d7fe0b..7326d60 100644
--- a/testsuites/psxtests/psxfile01/test.c
+++ b/testsuites/psxtests/psxfile01/test.c
@@ -617,7 +617,7 @@ since new path is not valid");
   rtems_test_assert( !status );
 
   /*
-   * Verify truncate changed only atime.
+   * Verify truncate changed all except atime.
    */
   status = stat( "/tmp/j", &buf );
   rtems_test_assert( !status );
@@ -625,9 +625,9 @@ since new path is not valid");
   atime2 = buf.st_atime;
   mtime2 = buf.st_mtime;
   ctime2 = buf.st_ctime;
-  rtems_test_assert( atime1 != atime2);
-  rtems_test_assert( mtime1 == mtime2);
-  rtems_test_assert( ctime1 == ctime2);
+  rtems_test_assert( atime1 == atime2);
+  rtems_test_assert( mtime1 != mtime2);
+  rtems_test_assert( ctime1 != ctime2);
 
   IMFS_dump();
 




More information about the vc mailing list