Skip to content

Commit

Permalink
fix: Report error when os.CreateTemp fails (to be consistent with oth…
Browse files Browse the repository at this point in the history
…er uses) (#5342)
  • Loading branch information
dougdonohoe committed Oct 5, 2023
1 parent 2798df9 commit ced54ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/fanal/image/daemon/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func DockerImage(ref name.Reference, host string) (Image, func(), error) {

f, err := os.CreateTemp("", "fanal-*")
if err != nil {
return nil, cleanup, xerrors.Errorf("failed to create a temporary file")
return nil, cleanup, xerrors.Errorf("failed to create a temporary file: %w", err)
}

cleanup = func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/image/daemon/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func PodmanImage(ref string) (Image, func(), error) {

f, err := os.CreateTemp("", "fanal-*")
if err != nil {
return nil, cleanup, xerrors.Errorf("failed to create a temporary file")
return nil, cleanup, xerrors.Errorf("failed to create a temporary file: %w", err)
}

cleanup = func() {
Expand Down

0 comments on commit ced54ac

Please sign in to comment.