[Coverity] Unchecked return value (CHECKED_RETURN)

This commit is contained in:
Peter D. Barnes, Jr.
2013-05-15 16:26:46 -04:00
parent 764cedd639
commit 80b15ea83f
5 changed files with 50 additions and 16 deletions

View File

@@ -308,11 +308,17 @@ MakeDirectories (std::string path)
{
std::string tmp = Join (elements.begin (), i);
#if defined(HAVE_MKDIR_H)
mkdir (tmp.c_str (), S_IRWXU);
if (mkdir (tmp.c_str (), S_IRWXU))
{
NS_LOG_ERROR ("failed creating directory " << tmp);
}
#endif
}
#if defined(HAVE_MKDIR_H)
mkdir (path.c_str (), S_IRWXU);
if (mkdir (path.c_str (), S_IRWXU))
{
NS_LOG_ERROR ("failed creating directory " << path);
}
#endif
}

View File

@@ -2206,7 +2206,10 @@ DsrRouting::ScheduleNetworkPacketRetry (MaintainBuffEntry & mb,
networkKey.m_destination = newEntry.GetDst ();
m_addressForwardCnt[networkKey] = 0;
m_maintainBuffer.Enqueue (newEntry);
if (! m_maintainBuffer.Enqueue (newEntry))
{
NS_LOG_ERROR ("Failed to enqueue packet retry");
}
if (m_addressForwardTimer.find (networkKey) == m_addressForwardTimer.end ())
{

View File

@@ -49,6 +49,8 @@
#include "ns3/config.h"
#include "ns3/ns2-mobility-helper.h"
NS_LOG_COMPONENT_DEFINE ("ns2-mobility-helper-test-suite");
namespace ns3 {
// -----------------------------------------------------------------------------
@@ -227,7 +229,10 @@ private:
void DoTeardown ()
{
Names::Clear ();
std::remove (m_traceFile.c_str ());
if (std::remove (m_traceFile.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_traceFile);
}
Simulator::Destroy ();
}

View File

@@ -22,11 +22,14 @@
#include <sstream>
#include <cstring>
#include "ns3/log.h"
#include "ns3/test.h"
#include "ns3/pcap-file.h"
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("pcap-file-test-suite");
// ===========================================================================
// Some utility functions for the tests.
// ===========================================================================
@@ -113,7 +116,10 @@ WriteModeCreateTestCase::DoSetup (void)
void
WriteModeCreateTestCase::DoTeardown (void)
{
remove (m_testFilename.c_str ());
if (remove (m_testFilename.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_testFilename);
}
}
void
@@ -225,7 +231,10 @@ ReadModeCreateTestCase::DoSetup (void)
void
ReadModeCreateTestCase::DoTeardown (void)
{
remove (m_testFilename.c_str ());
if (remove (m_testFilename.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_testFilename);
}
}
void
@@ -331,7 +340,10 @@ AppendModeCreateTestCase::DoSetup (void)
void
AppendModeCreateTestCase::DoTeardown (void)
{
remove (m_testFilename.c_str ());
if (remove (m_testFilename.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_testFilename);
}
}
void
@@ -437,7 +449,10 @@ FileHeaderTestCase::DoSetup (void)
void
FileHeaderTestCase::DoTeardown (void)
{
remove (m_testFilename.c_str ());
if (remove (m_testFilename.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_testFilename);
}
}
void
@@ -674,7 +689,10 @@ RecordHeaderTestCase::DoSetup (void)
void
RecordHeaderTestCase::DoTeardown (void)
{
remove (m_testFilename.c_str ());
if (remove (m_testFilename.c_str ()))
{
NS_LOG_ERROR ("Failed to delete file " << m_testFilename);
}
}
void

View File

@@ -187,14 +187,16 @@ void
CollisionExperiment::Receive (Ptr<Packet> p, double snr, WifiMode mode, enum WifiPreamble preamble)
{
FlowIdTag tag;
p->FindFirstMatchingByteTag (tag);
if (tag.GetFlowId () == m_flowIdA)
if (p->FindFirstMatchingByteTag (tag))
{
m_output.receivedA++;
}
else if (tag.GetFlowId () == m_flowIdB)
{
m_output.receivedB++;
if (tag.GetFlowId () == m_flowIdA)
{
m_output.receivedA++;
}
else if (tag.GetFlowId () == m_flowIdB)
{
m_output.receivedB++;
}
}
}