File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 6
6
"context"
7
7
"crypto/md5"
8
8
"encoding/json"
9
+ "errors"
9
10
"fmt"
10
11
"io"
11
12
"log"
@@ -564,20 +565,21 @@ func saveState(f string, state *state) error {
564
565
var errFileNotFoundByInode = fmt .Errorf ("old file not found" )
565
566
566
567
func findFileByInode (inode uint , dir string ) (string , error ) {
567
- entries , err := os .ReadDir (dir )
568
- if err != nil {
569
- return "" , err
570
- }
568
+ entries , readDirErr := os .ReadDir (dir )
571
569
for _ , entry := range entries {
572
570
fi , err := entry .Info ()
573
- if err != nil {
571
+ if err != nil && ! errors . Is ( err , os . ErrNotExist ) {
574
572
return "" , err
575
573
}
576
574
if detectInode (fi ) == inode {
577
575
return filepath .Join (dir , fi .Name ()), nil
578
576
}
579
577
}
580
- return "" , errFileNotFoundByInode
578
+ err := errFileNotFoundByInode
579
+ if readDirErr != nil {
580
+ err = errors .Join (err , readDirErr )
581
+ }
582
+ return "" , err
581
583
}
582
584
583
585
func openOldFile (f string , state * state ) (* os.File , error ) {
You can’t perform that action at this time.
0 commit comments