[rtems commit] libcsupport: Do not use _Assert() for sync()

Sebastian Huber sebh at rtems.org
Fri Dec 12 12:18:48 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Dec 12 11:03:42 2014 +0100

libcsupport: Do not use _Assert() for sync()

Use a best-effort approach.

---

 cpukit/libcsupport/src/sync.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index f27349c..9f6e31b 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -29,7 +29,6 @@ int fdatasync(int);        /* still not always prototyped */
 #include <stdio.h>
 
 #include <rtems.h>
-#include <rtems/score/assert.h>
 
 /* XXX check standards -- Linux version appears to be void */
 void _fwalk(struct _reent *, void *);
@@ -38,19 +37,12 @@ void _fwalk(struct _reent *, void *);
 static void sync_wrapper(FILE *f)
 {
   int fn = fileno(f);
-  int rc;
 
   /*
-   *  We are explicitly NOT checking the return values in non-debug builds
-   *  as it does not matter if they succeed.  We are just making a best
-   *  faith attempt at both and trusting that we were passed a good
-   *  FILE pointer.
+   * There is no way to report errors here.  So this is a best-effort approach.
    */
-  rc = fsync(fn);
-  _Assert( rc == 0 );
-
-  rc = fdatasync(fn);
-  _Assert( rc == 0 );
+  (void) fsync(fn);
+  (void) fdatasync(fn);
 }
 
 /* iterate over all FILE *'s for this thread */



More information about the vc mailing list