Skip to content

Commit de7167d

Browse files
committed
Flush a few more files
1 parent 5707624 commit de7167d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

smbz2/src/natives_bzip2.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use core::ffi::c_char;
1616
use core::ffi::c_void;
1717
use std::io::BufReader;
1818
use std::io::BufWriter;
19+
use std::io::Write;
1920
use std::num::NonZeroU32;
2021
use std::ptr::NonNull;
2122

@@ -43,7 +44,7 @@ fn worker_internal(info: &Bz2Info) -> BZ_Error {
4344
return BZ_Error::BZ_IO_ERROR_OUTPUT;
4445
};
4546
let inbuf = BufReader::new(infilefull);
46-
let mut outbuf = BufWriter::new(outfilefull);
47+
let mut outbuf: BufWriter<std::fs::File> = BufWriter::new(outfilefull);
4748

4849
let ioresult = if let Some(compressionLevel) = info.compressionLevel {
4950
let compressionLevel = bzip2::Compression::new(compressionLevel as u32);
@@ -55,7 +56,10 @@ fn worker_internal(info: &Bz2Info) -> BZ_Error {
5556
};
5657

5758
match ioresult {
58-
Ok(_) => BZ_Error::BZ_OK,
59+
Ok(_) => match outbuf.flush() {
60+
Ok(_) => BZ_Error::BZ_OK,
61+
_ => BZ_Error::BZ_IO_ERROR,
62+
},
5963
_ => BZ_Error::BZ_IO_ERROR,
6064
}
6165
}

srcwrjson/src/natives_json.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ pub fn rust_SRCWRJSON_ToFile_Inner<T: Write>(
333333
"{}",
334334
if 0 != (flags & J_FILE_NULL_TERMINATE) { "\0" } else { "\n" }
335335
);
336+
writer.flush().ok()?;
336337
Some(())
337338
}
338339

0 commit comments

Comments
 (0)