Skip to content

Commit

Permalink
chore: use defer and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijie-yang committed Nov 27, 2024
1 parent f903c25 commit 2a97dcc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/deb/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ func getDataReader(pkgReader io.ReadSeeker) (io.ReadCloser, error) {
func extractData(pkgReader io.ReadSeeker, options *ExtractOptions) error {

dataReader, err := getDataReader(pkgReader)
defer dataReader.Close()

if err != nil {
return err
}
Expand Down Expand Up @@ -338,8 +340,6 @@ func extractData(pkgReader io.ReadSeeker, options *ExtractOptions) error {
}
}

dataReader.Close()

return nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/fsutil/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func Create(options *CreateOptions) (*Entry, error) {
return nil, err
}
mode := s.Mode()
// Overrides mode if the entry is not a link and the mode differs.
if o.OverrideMode && mode != o.Mode && o.Link == "" {
err := os.Chmod(o.Path, o.Mode)
if err != nil {
Expand Down

0 comments on commit 2a97dcc

Please sign in to comment.