mirror of https://github.com/containers/podman.git
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>
This commit is contained in:
parent
6052914222
commit
931c08157e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue