From 34527a3176a26857d39c946af07355850d207fa8 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Mon, 19 Apr 2010 10:10:49 -0700 Subject: [PATCH] break down and check return values --- src/test/perf/perf-io.cc | 6 +++++- utils/test-runner.cc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/perf/perf-io.cc b/src/test/perf/perf-io.cc index 0a74a063e..aad9ccd4d 100644 --- a/src/test/perf/perf-io.cc +++ b/src/test/perf/perf-io.cc @@ -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 @@ PerfFile (FILE *file, uint32_t n, const char *buffer, uint32_t size) { 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"); + } } } diff --git a/utils/test-runner.cc b/utils/test-runner.cc index a524e5385..7916baf4a 100644 --- a/utils/test-runner.cc +++ b/utils/test-runner.cc @@ -18,6 +18,7 @@ #include "ns3/test.h" #include "ns3/assert.h" +#include "ns3/abort.h" #include #include @@ -107,7 +108,10 @@ BaseDir (void) // 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