1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-05 08:25:58 +00:00

Merge pull request #41 from stephen679/fix_too_many_files_open

[bug fix] tar: explicitly close files after populateTree
This commit is contained in:
Vincent Batts 2016-07-26 11:56:57 -04:00 committed by GitHub
commit 39f68f5be2

5
tar.go
View file

@ -93,9 +93,6 @@ func (ts *tarStream) readHeaders() {
ts.pipeReader.CloseWithError(err)
return
}
defer tmpFile.Close()
defer os.Remove(tmpFile.Name())
// Alright, it's either file or directory
encodedName, err := Vis(filepath.Base(hdr.Name))
if err != nil {
@ -175,6 +172,8 @@ func (ts *tarStream) readHeaders() {
}
}
populateTree(&root, &e, hdr, ts)
tmpFile.Close()
os.Remove(tmpFile.Name())
}
}