summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-11-24 10:34:16 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2021-11-29 16:41:11 -0500
commit931c08157e6032837f1a1b52a822e9e276b72e91 (patch)
tree5e5929e1f410d13d0e2100e098e5bbe5a3976a6f /pkg/domain
parent60529142223218483ea3d68975bea86aa89ac6fe (diff)
downloadpodman-931c08157e6032837f1a1b52a822e9e276b72e91.tar.gz
podman-931c08157e6032837f1a1b52a822e9e276b72e91.tar.bz2
podman-931c08157e6032837f1a1b52a822e9e276b72e91.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.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go
index fde57972f..2feb9d7ad 100644
--- a/pkg/domain/infra/tunnel/images.go
+++ b/pkg/domain/infra/tunnel/images.go
@@ -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