break down and check return values

This commit is contained in:
Craig Dowell
2010-04-19 10:10:49 -07:00
parent 3c34f80a47
commit 34527a3176
2 changed files with 10 additions and 2 deletions

View File

@@ -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");
}
}
}

View File

@@ -18,6 +18,7 @@
#include "ns3/test.h"
#include "ns3/assert.h"
#include "ns3/abort.h"
#include <iostream>
#include <fstream>
@@ -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