[PATCH 19/20] libcsupport/src/sync.c: Explicitly ignore return status

Joel Sherrill joel.sherrill at oarcorp.com
Tue Nov 25 23:02:47 UTC 2014


From: Josh Oguin <josh.oguin at oarcorp.com>

CodeSonar spotted that the return values were being ignored.
---
 cpukit/libcsupport/src/sync.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpukit/libcsupport/src/sync.c b/cpukit/libcsupport/src/sync.c
index b8e5059..0e935ce 100644
--- a/cpukit/libcsupport/src/sync.c
+++ b/cpukit/libcsupport/src/sync.c
@@ -43,8 +43,10 @@ static void sync_wrapper(FILE *f)
    *  matter if they succeed.  We are just making a best faith attempt
    *  at both and trusting that we were passed a good FILE pointer.
    */
-  (void) fsync(fn);
-  (void) fdatasync(fn);
+  if ( fn != -1 ) {
+    (void) fsync(fn);
+    (void) fdatasync(fn);
+  }
 }
 
 /* iterate over all FILE *'s for this thread */
-- 
1.9.3




More information about the devel mailing list