mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 02:48:55 +00:00
Remove closing logic from Packer.Finalize
The method only ever receives *hashing.Writers, which don't implement io.Closer. These come from packerManager.findPacker and have their actual writers closed in Repository.savePacker. Moving the closing logic to hashing.Writer results in "file already closed" errors.
This commit is contained in:
parent
c542a509f0
commit
a23e9c86ba
@ -61,8 +61,7 @@ type headerEntry struct {
|
||||
}
|
||||
|
||||
// Finalize writes the header for all added blobs and finalizes the pack.
|
||||
// Returned are the number of bytes written, including the header. If the
|
||||
// underlying writer implements io.Closer, it is closed.
|
||||
// Returned are the number of bytes written, including the header.
|
||||
func (p *Packer) Finalize() (uint, error) {
|
||||
p.m.Lock()
|
||||
defer p.m.Unlock()
|
||||
@ -101,11 +100,6 @@ func (p *Packer) Finalize() (uint, error) {
|
||||
bytesWritten += uint(binary.Size(uint32(0)))
|
||||
|
||||
p.bytes = uint(bytesWritten)
|
||||
|
||||
if w, ok := p.wr.(io.Closer); ok {
|
||||
return bytesWritten, w.Close()
|
||||
}
|
||||
|
||||
return bytesWritten, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user