sectorstorage: Fix potential panic in FinalizeSector
This commit is contained in:
parent
867ca2f25d
commit
baef3c8dd2
11
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
11
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
@ -546,10 +546,7 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector abi.SectorID, keepU
|
||||
defer done()
|
||||
|
||||
pf, err := openPartialFile(maxPieceSize, paths.Unsealed)
|
||||
if xerrors.Is(err, os.ErrNotExist) {
|
||||
return xerrors.Errorf("opening partial file: %w", err)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
var at uint64
|
||||
for sr.HasNext() {
|
||||
r, err := sr.NextRun()
|
||||
@ -574,6 +571,12 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector abi.SectorID, keepU
|
||||
if err := pf.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if !xerrors.Is(err, os.ErrNotExist) {
|
||||
return xerrors.Errorf("opening partial file: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
paths, done, err := sb.sectors.AcquireSector(ctx, sector, stores.FTCache, 0, stores.PathStorage)
|
||||
|
Loading…
Reference in New Issue
Block a user