Skip to content

Commit

Permalink
fix file/directory permissions within mysqlctl
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Robenolt <[email protected]>
  • Loading branch information
mattrobenolt committed Jan 29, 2025
1 parent 9ddc845 commit 704c9e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions go/vt/mysqlctl/mysqld.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"vitess.io/vitess/config"
"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/mysql/sqlerror"
"vitess.io/vitess/go/os2"
"vitess.io/vitess/go/osutil"
"vitess.io/vitess/go/protoutil"
"vitess.io/vitess/go/sqltypes"
Expand Down Expand Up @@ -901,7 +902,7 @@ func (mysqld *Mysqld) initConfig(cnf *Mycnf, outFile string) error {
return err
}

return os.WriteFile(outFile, []byte(configData), 0o664)
return os2.WriteFile(outFile, []byte(configData))
}

func (mysqld *Mysqld) getMycnfTemplate() string {
Expand Down Expand Up @@ -1051,7 +1052,7 @@ func (mysqld *Mysqld) ReinitConfig(ctx context.Context, cnf *Mycnf) error {
func (mysqld *Mysqld) createDirs(cnf *Mycnf) error {
tabletDir := cnf.TabletDir()
log.Infof("creating directory %s", tabletDir)
if err := os.MkdirAll(tabletDir, os.ModePerm); err != nil {
if err := os2.MkdirAll(tabletDir); err != nil {
return err
}
for _, dir := range TopLevelDirs() {
Expand All @@ -1061,7 +1062,7 @@ func (mysqld *Mysqld) createDirs(cnf *Mycnf) error {
}
for _, dir := range cnf.directoryList() {
log.Infof("creating directory %s", dir)
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
if err := os2.MkdirAll(dir); err != nil {
return err
}
// FIXME(msolomon) validate permissions?
Expand All @@ -1085,14 +1086,14 @@ func (mysqld *Mysqld) createTopDir(cnf *Mycnf, dir string) error {
if os.IsNotExist(err) {
topdir := path.Join(tabletDir, dir)
log.Infof("creating directory %s", topdir)
return os.MkdirAll(topdir, os.ModePerm)
return os2.MkdirAll(topdir)
}
return err
}
linkto := path.Join(target, vtname)
source := path.Join(tabletDir, dir)
log.Infof("creating directory %s", linkto)
err = os.MkdirAll(linkto, os.ModePerm)
err = os2.MkdirAll(linkto)
if err != nil {
return err
}
Expand Down

0 comments on commit 704c9e2

Please sign in to comment.