(c.FileOpenFile)(&self, cfg.files_sbcfg, *track_id,
name.as_ptr(), name.len() as u16,
ptr::null(), 0u32, flags);
-
- //if !res {
- // panic!("c.fn_fileopenfile failed");
- //}
0
}
}
r
},
};
- if res != 0 {
- panic!("c.fn_fileappenddata failed");
- }
res
}
}
None => panic!("BUG no suricata_config"),
Some(c) => {
let res = (c.FileCloseFile)(&self, *track_id, ptr::null(), 0u32, flags);
- if res != 0 {
- panic!("c.fn_fileclosefile failed");
- }
res
}
}
if self.chunk_is_ooo == false {
let res = files.file_append(&self.track_id, d, is_gap);
- if res != 0 { panic!("append failed"); }
+ match res {
+ 0 => { },
+ -2 => {
+ self.file_is_truncated = true;
+ },
+ _ => { panic!("append failed with code {}", res); },
+ }
self.tracked += self.chunk_left as u64;
} else {
match self.chunks.remove(&self.tracked) {
Some(c) => {
let res = files.file_append(&self.track_id, &c.chunk, c.contains_gap);
- if res != 0 { panic!("append failed: files.file_append() returned {}", res); }
+ match res {
+ 0 => { },
+ -2 => {
+ self.file_is_truncated = true;
+ },
+ _ => {
+ panic!("append failed: files.file_append() returned {}", res);
+ },
+ }
self.tracked += c.chunk.len() as u64;
self.cur_ooo -= c.chunk.len() as u64;
} else {
if self.chunk_is_ooo == false {
let res = files.file_append(&self.track_id, data, is_gap);
- if res != 0 { panic!("append failed"); }
+ match res {
+ 0 => { },
+ -2 => {
+ self.file_is_truncated = true;
+ },
+ _ => { panic!("append failed with code {}", res); },
+ }
self.tracked += data.len() as u64;
} else {
let c = match self.chunks.entry(self.cur_ooo_chunk_offset) {