File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -659,14 +659,18 @@ where
659659 . map_err ( Error :: DeviceError ) ?;
660660 written += to_copy;
661661 file. current_cluster = current_cluster;
662- let to_copy = i32:: try_from ( to_copy) . map_err ( |_| Error :: ConversionError ) ?;
663- // TODO: Should we do this once when the whole file is written?
664- file. update_length ( file. length + ( to_copy as u32 ) ) ;
665- file. seek_from_current ( to_copy) . unwrap ( ) ;
666- file. entry . attributes . set_archive ( true ) ;
667- file. entry . mtime = self . timesource . get_timestamp ( ) ;
662+
663+ let to_copy = to_copy as u32 ;
664+ let new_offset = file. current_offset + to_copy;
665+ if new_offset > file. length {
666+ // We made it longer
667+ file. update_length ( new_offset) ;
668+ }
669+ file. seek_from_start ( new_offset) . unwrap ( ) ;
668670 // Entry update deferred to file close, for performance.
669671 }
672+ file. entry . attributes . set_archive ( true ) ;
673+ file. entry . mtime = self . timesource . get_timestamp ( ) ;
670674 Ok ( written)
671675 }
672676
You can’t perform that action at this time.
0 commit comments