File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ use core::ffi::c_char;
1616use core:: ffi:: c_void;
1717use std:: io:: BufReader ;
1818use std:: io:: BufWriter ;
19+ use std:: io:: Write ;
1920use std:: num:: NonZeroU32 ;
2021use 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments