Skip to content

Commit

Permalink
Merge pull request #21857 from vrothberg/fix-21849
Browse files Browse the repository at this point in the history
machine config: make write atomic
  • Loading branch information
openshift-merge-bot[bot] authored Feb 28, 2024
2 parents 9d17043 + f8abd7f commit 2d4ef6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/machine/vmconfigs/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/containers/podman/v5/pkg/machine/define"
"github.com/containers/podman/v5/pkg/machine/lock"
"github.com/containers/podman/v5/utils"
"github.com/containers/storage/pkg/ioutils"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -133,7 +134,7 @@ func (mc *MachineConfig) write() error {
return err
}
logrus.Debugf("writing configuration file %q", mc.configPath.Path)
return os.WriteFile(mc.configPath.GetPath(), b, define.DefaultFilePerm)
return ioutils.AtomicWriteFile(mc.configPath.GetPath(), b, define.DefaultFilePerm)
}

func (mc *MachineConfig) SetRootful(rootful bool) error {
Expand Down

0 comments on commit 2d4ef6f

Please sign in to comment.