diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-11-24 10:34:16 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-12-06 15:35:50 -0500 |
commit | e1cf9d4c28af64035984b8963f73fb92b29480f3 (patch) | |
tree | 40ee74f739ed885eb635e88751be273b7793ed85 /pkg/domain | |
parent | e2d6948157123922e9be0f451074256b1a26222a (diff) | |
download | podman-e1cf9d4c28af64035984b8963f73fb92b29480f3.tar.gz podman-e1cf9d4c28af64035984b8963f73fb92b29480f3.tar.bz2 podman-e1cf9d4c28af64035984b8963f73fb92b29480f3.zip |
Only open save output file with WRONLY
The previous code fails on a MAC when opening /dev/stdout
Fixes: https://github.com/containers/podman/issues/12402
[NO NEW TESTS NEEDED] No easy way to test this.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/tunnel/images.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index ab2a93c75..14dc5b92c 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -264,7 +264,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 |