Skip to content

Commit

Permalink
archive: cleanup and more information
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Batts <[email protected]>
Signed-off-by: Vincent Batts <[email protected]>
  • Loading branch information
vbatts committed Oct 29, 2014
1 parent f710a8d commit f14a9ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ func (ta *tarAppender) addTarFile(path, name string) error {
hdr.Devmajor = int64(major(uint64(stat.Rdev)))
hdr.Devminor = int64(minor(uint64(stat.Rdev)))
}

}

// if it's a regular file and has more than 1 link,
Expand Down Expand Up @@ -228,6 +227,7 @@ func (ta *tarAppender) addTarFile(path, name string) error {
}

ta.Buffer.Reset(ta.TarWriter)
defer ta.Buffer.Reset(nil)
_, err = io.Copy(ta.Buffer, file)
file.Close()
if err != nil {
Expand All @@ -237,7 +237,6 @@ func (ta *tarAppender) addTarFile(path, name string) error {
if err != nil {
return err
}
ta.Buffer.Reset(nil)
}

return nil
Expand Down
6 changes: 5 additions & 1 deletion pkg/archive/changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ func ChangesDirs(newDir, oldDir string) ([]Change, error) {
newRoot, err2 = collectFileInfo(newDir)
errs <- err2
}()

// block until both routines have returned
for i := 0; i < 2; i++ {
if err := <-errs; err != nil {
return nil, err
Expand Down Expand Up @@ -409,7 +411,9 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
if err := ta.TarWriter.Close(); err != nil {
log.Debugf("Can't close layer: %s", err)
}
writer.Close()
if err := writer.Close(); err != nil {
log.Debugf("failed close Changes writer: %s", err)
}
}()
return reader, nil
}

0 comments on commit f14a9ed

Please sign in to comment.