Skip to content

Commit

Permalink
Merge pull request containers#12408 from rhatdan/stdout
Browse files Browse the repository at this point in the history
Only open save output file with WRONLY
  • Loading branch information
openshift-merge-robot authored Nov 30, 2021
2 parents d51ebca + 931c081 commit 8de68b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/domain/infra/tunnel/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string,
defer func() { _ = os.Remove(f.Name()) }()
}
default:
f, err = os.Create(opts.Output)
// This code was added to allow for opening stdout replacing
// os.Create(opts.Output) which was attempting to open the file
// for read/write which fails on Darwin platforms
f, err = os.OpenFile(opts.Output, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
}
if err != nil {
return err
Expand Down

0 comments on commit 8de68b1

Please sign in to comment.