mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 05:28:20 +00:00
Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath: Fix checking of fwrite return values Some didn't look quite right so fixed while merging: the return value of fwrite is in terms of number of objects written, not number of bytes written and some calls still mixed those up.
This commit is contained in:
commit
432744fde4
3 changed files with 12 additions and 9 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
|||
|
||||
2.3-263 | 2014-10-28 15:09:10 -0500
|
||||
|
||||
* Fix checking of fwrite return values (Johanna Amann)
|
||||
|
||||
2.3-260 | 2014-10-27 12:54:17 -0500
|
||||
|
||||
* Fix errors/warnings when compiling with -std=c++11 (Jon Siwek)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.3-260
|
||||
2.3-263
|
||||
|
|
15
src/File.cc
15
src/File.cc
|
@ -708,10 +708,10 @@ void BroFile::InitEncrypt(const char* keyfile)
|
|||
|
||||
secret_len = htonl(secret_len);
|
||||
|
||||
if ( ! (fwrite("BROENC1", 7, 1, f) &&
|
||||
fwrite(&secret_len, sizeof(secret_len), 1, f) &&
|
||||
fwrite(secret, ntohl(secret_len), 1, f) &&
|
||||
fwrite(iv, iv_len, 1, f)) )
|
||||
if ( fwrite("BROENC1", 7, 1, f) < 1 ||
|
||||
fwrite(&secret_len, sizeof(secret_len), 1, f) < 1 ||
|
||||
fwrite(secret, ntohl(secret_len), 1, f) < 1 ||
|
||||
fwrite(iv, iv_len, 1, f) < 1 )
|
||||
{
|
||||
reporter->Error("can't write header to log file %s: %s",
|
||||
name, strerror(errno));
|
||||
|
@ -736,7 +736,7 @@ void BroFile::FinishEncrypt()
|
|||
int outl;
|
||||
EVP_SealFinal(cipher_ctx, cipher_buffer, &outl);
|
||||
|
||||
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) )
|
||||
if ( outl && fwrite(cipher_buffer, outl, 1, f) < 1 )
|
||||
{
|
||||
reporter->Error("write error for %s: %s",
|
||||
name, strerror(errno));
|
||||
|
@ -777,7 +777,7 @@ int BroFile::Write(const char* data, int len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ( outl && ! fwrite(cipher_buffer, outl, 1, f) )
|
||||
if ( outl && fwrite(cipher_buffer, outl, 1, f) < 1 )
|
||||
{
|
||||
reporter->Error("write error for %s: %s",
|
||||
name, strerror(errno));
|
||||
|
@ -792,8 +792,7 @@ int BroFile::Write(const char* data, int len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
len = fwrite(data, 1, len, f);
|
||||
if ( len <= 0 )
|
||||
if ( fwrite(data, len, 1, f) < 1 )
|
||||
return false;
|
||||
|
||||
if ( rotate_size && current_size < rotate_size && current_size + len >= rotate_size )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue