Merge remote-tracking branch 'origin/topic/jsiwek/coverity'

* origin/topic/jsiwek/coverity:
  Fix uninitialized (or unused) fields.
  Remove logically dead code.
  Remove dead/unfinished code in unary not expr.
  Fix logic for failed DNS TXT lookups.
  A couple null ptr checks.
  Improve return value checking and error handling.
  Remove unused variable assignments, dead code.
  Prevent division/modulo by zero in scripts.
  Fix unintentional always-false condition.
  Fix invalidated iterator usage.
  Fix DNS_Mgr iterator mismatch.
  Set safe umask when creating script profiler tmp files.
  Fix nesting/indent level whitespace mismatch.
  Add checks to avoid improper negative values use.

BIT-1085 #merged
This commit is contained in:
Robin Sommer 2013-10-02 11:03:29 -07:00
commit d127d8d01d
86 changed files with 517 additions and 242 deletions

View file

@ -6,6 +6,7 @@
#include <map>
#include <stdio.h>
#include <errno.h>
#include <string>
#include <vector>
@ -80,7 +81,13 @@ bool LoadPolicyFileText(const char* policy_filename)
policy_files.insert(PolicyFileMap::value_type(policy_filename, pf));
struct stat st;
fstat(fileno(f), &st);
if ( fstat(fileno(f), &st) != 0 )
{
char buf[256];
strerror_r(errno, buf, sizeof(buf));
reporter->Error("fstat failed on %s: %s", policy_filename, buf);
return false;
}
pf->lmtime = st.st_mtime;
off_t size = st.st_size;