rust/file: handle file open errors

pull/3201/head
Victor Julien 8 years ago
parent 45c5030ff0
commit 3a2e4614d0

@ -95,8 +95,8 @@ impl FileTransferTracker {
let r = files.file_open(config, &self.track_id, name, flags); let r = files.file_open(config, &self.track_id, name, flags);
if r == 0 { if r == 0 {
files.file_set_txid_on_last_file(self.tx_id); files.file_set_txid_on_last_file(self.tx_id);
self.file_open = true;
} }
self.file_open = true;
r r
} }
@ -110,7 +110,7 @@ impl FileTransferTracker {
} }
pub fn trunc (&mut self, files: &mut FileContainer, flags: u16) { pub fn trunc (&mut self, files: &mut FileContainer, flags: u16) {
if self.file_is_truncated { if self.file_is_truncated || !self.file_open {
return; return;
} }
let myflags = flags | 1; // TODO util-file.c::FILE_TRUNCATED let myflags = flags | 1; // TODO util-file.c::FILE_TRUNCATED
@ -159,9 +159,13 @@ impl FileTransferTracker {
self.open(config, files, flags, name); self.open(config, files, flags, name);
} }
let res = self.update(files, flags, data, 0); if self.file_open == true {
SCLogDebug!("NEW CHUNK: update res {:?}", res); let res = self.update(files, flags, data, 0);
res SCLogDebug!("NEW CHUNK: update res {:?}", res);
return res;
}
0
} }
/// update the file tracker /// update the file tracker

Loading…
Cancel
Save