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 4da7024
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions internal/deb/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func extractData(pkgReader io.ReadSeeker, options *ExtractOptions) error {
if err != nil {
return err
}
defer dataReader.Close()

oldUmask := syscall.Umask(0)
defer func() {
Expand Down Expand Up @@ -338,8 +339,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 4da7024

Please sign in to comment.