]> Cypherpunks repositories - gostls13.git/commitdiff
archive/zip: actually close file opened with OpenReader.
authorDmitry Chestnykh <dchest@gmail.com>
Mon, 7 Nov 2011 05:33:53 +0000 (16:33 +1100)
committerAndrew Gerrand <adg@golang.org>
Mon, 7 Nov 2011 05:33:53 +0000 (16:33 +1100)
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5341044

src/pkg/archive/zip/reader.go
src/pkg/archive/zip/reader_test.go

index b705ebe7ea6f346c9dc9b49892ed7e9f50988dfb..cfbe5498a157995258cd13129bbb0b8ec113ef85 100644 (file)
@@ -60,6 +60,7 @@ func OpenReader(name string) (*ReadCloser, error) {
                f.Close()
                return nil, err
        }
+       r.f = f
        return r, nil
 }
 
index 4d80aab709eae1eecc165002c61dcb7db2ca310c..ca0b04e2bba397ad64ab32913b0d446885d6ae37 100644 (file)
@@ -98,7 +98,11 @@ func readTestZip(t *testing.T, zt ZipTest) {
        if err == FormatError {
                return
        }
-       defer z.Close()
+       defer func() {
+               if err := z.Close(); err != nil {
+                       t.Errorf("error %q when closing zip file", err)
+               }
+       }()
 
        // bail here if no Files expected to be tested
        // (there may actually be files in the zip, but we don't care)