mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Improve return value checking and error handling.
This commit is contained in:
parent
4b24cebad9
commit
daf5d0d098
14 changed files with 101 additions and 33 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -80,7 +81,12 @@ 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->InternalError("fstat failed on %s: %s", policy_filename, buf);
|
||||
}
|
||||
|
||||
pf->lmtime = st.st_mtime;
|
||||
off_t size = st.st_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue