From: Victor Julien Date: Thu, 25 Jan 2018 14:31:35 +0000 (+0100) Subject: rust/filetracker: if file API return error, trunc file X-Git-Tag: suricata-4.0.4~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a83c9a376d0168ba322bbe1986d45bc723383e83;p=thirdparty%2Fsuricata.git rust/filetracker: if file API return error, trunc file --- diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index 9092599922..aa9acfa63a 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -212,7 +212,10 @@ impl FileTransferTracker { -2 => { self.file_is_truncated = true; }, - _ => { panic!("append failed with code {}", res); }, + _ => { + SCLogDebug!("got error so truncing file"); + self.file_is_truncated = true; + }, } self.tracked += self.chunk_left as u64; @@ -258,7 +261,8 @@ impl FileTransferTracker { self.file_is_truncated = true; }, _ => { - panic!("append failed: files.file_append() returned {}", res); + SCLogDebug!("got error so truncing file"); + self.file_is_truncated = true; }, } @@ -296,7 +300,10 @@ impl FileTransferTracker { -2 => { self.file_is_truncated = true; }, - _ => { panic!("append failed with code {}", res); }, + _ => { + SCLogDebug!("got error so truncing file"); + self.file_is_truncated = true; + }, } self.tracked += data.len() as u64; } else {