Skip to content

Commit

Permalink
Merge pull request #1515 from mtrmac/atomic-auth.json
Browse files Browse the repository at this point in the history
Use c/storage/pkg/ioutils.AtomicWriteFiles to update auth.json
  • Loading branch information
vrothberg authored Apr 5, 2022
2 parents 676bf00 + b12b8a2 commit 57996f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/docker/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/image/v5/types"
"github.com/containers/storage/pkg/homedir"
"github.com/containers/storage/pkg/ioutils"
helperclient "github.com/docker/docker-credential-helpers/client"
"github.com/docker/docker-credential-helpers/credentials"
"github.com/hashicorp/go-multierror"
Expand Down Expand Up @@ -605,7 +606,7 @@ func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (
return "", errors.Wrapf(err, "marshaling JSON %q", path)
}

if err = ioutil.WriteFile(path, newData, 0600); err != nil {
if err = ioutils.AtomicWriteFile(path, newData, 0600); err != nil {
return "", errors.Wrapf(err, "writing to file %q", path)
}
}
Expand Down

0 comments on commit 57996f8

Please sign in to comment.