break down and check return values
authorCraig Dowell <craigdo@ee.washington.edu>
Mon, 19 Apr 2010 10:10:49 -0700
changeset 6248 3ccf4cea2480
parent 6247 ab7f2498373a
child 6249 bb33e80b06b0
break down and check return values
src/test/perf/perf-io.cc
utils/test-runner.cc
--- a/src/test/perf/perf-io.cc	Mon Apr 19 09:03:24 2010 -0700
+++ b/src/test/perf/perf-io.cc	Mon Apr 19 10:10:49 2010 -0700
@@ -27,6 +27,7 @@
 #include "ns3/node-module.h"
 #include "ns3/core-module.h"
 #include "ns3/helper-module.h"
+#include "ns3/abort.h"
 
 using namespace ns3;
 using namespace std;
@@ -50,7 +51,10 @@
 {
   for (uint32_t i = 0; i < n; ++i)
     {
-      size_t __attribute__ ((unused)) result = fwrite (buffer, 1, size, file);
+      if (fwrite (buffer, 1, size, file) !=  size)
+        {
+          NS_ABORT_MSG ("PerfFile():  fwrite error");
+        }
     }
 }
 
--- a/utils/test-runner.cc	Mon Apr 19 09:03:24 2010 -0700
+++ b/utils/test-runner.cc	Mon Apr 19 10:10:49 2010 -0700
@@ -18,6 +18,7 @@
 
 #include "ns3/test.h"
 #include "ns3/assert.h"
+#include "ns3/abort.h"
 
 #include <iostream>
 #include <fstream>
@@ -107,7 +108,10 @@
   // depends on the leading '/'
   //
   char pathbuf[PATH_MAX];
-  char * __attribute__ ((unused)) p = getcwd (pathbuf, sizeof(pathbuf));
+  if (getcwd (pathbuf, sizeof(pathbuf)) == NULL)
+    {
+      NS_ABORT_MSG ("Basedir():  unable to getcwd()");
+    }
 
   //
   // Walk up the directory tree looking for a directory that has files that