]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/filetracker: if file API return error, trunc file
authorVictor Julien <victor@inliniac.net>
Thu, 25 Jan 2018 14:31:35 +0000 (15:31 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 12 Feb 2018 09:02:08 +0000 (10:02 +0100)
rust/src/filetracker.rs

index 9092599922752ef4cdfdf2df50b86bf430ad90b2..aa9acfa63abf336ddecdfadb36ddc249dcc548ff 100644 (file)
@@ -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 {