mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
More work on the interface to add/remove file analysis actions.
Added the file extraction action and did other misc. cleanup. Most of the minimal core features/support for file analysis should be working at this point, just have to start fleshing things out.
This commit is contained in:
parent
b9d204005d
commit
f04d189d3f
8 changed files with 398 additions and 74 deletions
25
src/util.cc
25
src/util.cc
|
@ -1391,6 +1391,31 @@ bool safe_write(int fd, const char* data, int len)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool safe_pwrite(int fd, const unsigned char* data, size_t len, size_t offset)
|
||||
{
|
||||
while ( len != 0 )
|
||||
{
|
||||
ssize_t n = pwrite(fd, data, len, offset);
|
||||
|
||||
if ( n < 0 )
|
||||
{
|
||||
if ( errno == EINTR )
|
||||
continue;
|
||||
|
||||
fprintf(stderr, "safe_write error: %d\n", errno);
|
||||
abort();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
data += n;
|
||||
offset +=n;
|
||||
len -= n;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void safe_close(int fd)
|
||||
{
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue