File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -473,24 +473,25 @@ impl<I> InMemoryOnDiskCorpus<I> {
473473
474474 fn remove_testcase ( & self , testcase : & Testcase < I > ) -> Result < ( ) , Error > {
475475 if let Some ( filename) = testcase. filename ( ) {
476- let mut ctr = String :: new ( ) ;
476+ let mut ctr = 0 ;
477477 if self . locking {
478478 let lockfile_path = self . dir_path . join ( format ! ( ".{filename}" ) ) ;
479479 let mut lockfile = OpenOptions :: new ( )
480480 . write ( true )
481481 . read ( true )
482482 . open ( & lockfile_path) ?;
483483
484+ let mut ctr_bytes = [ 0 ; 4 ] ;
484485 lockfile. lock_exclusive ( ) ?;
485- lockfile. read_to_string ( & mut ctr ) ?;
486- ctr = ctr . trim ( ) . to_string ( ) ;
486+ lockfile. read ( & mut ctr_bytes ) ?;
487+ ctr = u32 :: from_le_bytes ( ctr_bytes ) ;
487488
488- if ctr == "1" {
489+ if ctr == 1 {
489490 FileExt :: unlock ( & lockfile) ?;
490491 drop ( fs:: remove_file ( lockfile_path) ) ;
491492 } else {
492493 lockfile. seek ( SeekFrom :: Start ( 0 ) ) ?;
493- lockfile. write_all ( & ( ctr. parse :: < u32 > ( ) ? - 1 ) . to_le_bytes ( ) ) ?;
494+ lockfile. write_all ( & ( ctr - 1 ) . to_le_bytes ( ) ) ?;
494495 return Ok ( ( ) ) ;
495496 }
496497 }
You can’t perform that action at this time.
0 commit comments