diff --git a/cmd/ledis-dump/main.go b/cmd/ledis-dump/main.go index bf02ad7..b6a798d 100644 --- a/cmd/ledis-dump/main.go +++ b/cmd/ledis-dump/main.go @@ -23,7 +23,7 @@ func main() { var err error var f *os.File - if f, err = os.OpenFile(*dumpFile, os.O_CREATE|os.O_WRONLY, os.ModePerm); err != nil { + if f, err = os.OpenFile(*dumpFile, os.O_CREATE|os.O_WRONLY, 0644); err != nil { println(err.Error()) return } diff --git a/ledis/binlog.go b/ledis/binlog.go index 077398a..f26323e 100644 --- a/ledis/binlog.go +++ b/ledis/binlog.go @@ -117,7 +117,7 @@ func NewBinLog(cfg *config.Config) (*BinLog, error) { l.path = path.Join(cfg.DataDir, "binlog") - if err := os.MkdirAll(l.path, os.ModePerm); err != nil { + if err := os.MkdirAll(l.path, 0755); err != nil { return nil, err } diff --git a/server/replication.go b/server/replication.go index 267a29b..445a813 100644 --- a/server/replication.go +++ b/server/replication.go @@ -38,7 +38,7 @@ func (m *MasterInfo) Save(filePath string) error { filePathBak := fmt.Sprintf("%s.bak", filePath) var fd *os.File - fd, err = os.OpenFile(filePathBak, os.O_CREATE|os.O_WRONLY, os.ModePerm) + fd, err = os.OpenFile(filePathBak, os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err } @@ -250,7 +250,7 @@ func (m *master) fullSync() error { } dumpPath := path.Join(m.app.cfg.DataDir, "master.dump") - f, err := os.OpenFile(dumpPath, os.O_CREATE|os.O_WRONLY, os.ModePerm) + f, err := os.OpenFile(dumpPath, os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err } diff --git a/store/boltdb/db.go b/store/boltdb/db.go index f2cb1f3..15a0570 100644 --- a/store/boltdb/db.go +++ b/store/boltdb/db.go @@ -18,7 +18,7 @@ func (s Store) String() string { } func (s Store) Open(dbPath string, cfg *config.Config) (driver.IDB, error) { - os.MkdirAll(dbPath, os.ModePerm) + os.MkdirAll(dbPath, 0755) name := path.Join(dbPath, "ledis_bolt.db") db := new(DB) var err error diff --git a/store/goleveldb/db.go b/store/goleveldb/db.go index 2a13f50..dad6a90 100644 --- a/store/goleveldb/db.go +++ b/store/goleveldb/db.go @@ -47,7 +47,7 @@ type DB struct { } func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { - if err := os.MkdirAll(path, os.ModePerm); err != nil { + if err := os.MkdirAll(path, 0755); err != nil { return nil, err } diff --git a/store/hyperleveldb/db.go b/store/hyperleveldb/db.go index d6d7aeb..071dd38 100644 --- a/store/hyperleveldb/db.go +++ b/store/hyperleveldb/db.go @@ -28,7 +28,7 @@ func (s Store) String() string { } func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { - if err := os.MkdirAll(path, os.ModePerm); err != nil { + if err := os.MkdirAll(path, 0755); err != nil { return nil, err } diff --git a/store/leveldb/db.go b/store/leveldb/db.go index 92a2419..ab29928 100644 --- a/store/leveldb/db.go +++ b/store/leveldb/db.go @@ -28,7 +28,7 @@ func (s Store) String() string { } func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { - if err := os.MkdirAll(path, os.ModePerm); err != nil { + if err := os.MkdirAll(path, 0755); err != nil { return nil, err } diff --git a/store/rocksdb/db.go b/store/rocksdb/db.go index 1c79229..f3fb406 100644 --- a/store/rocksdb/db.go +++ b/store/rocksdb/db.go @@ -29,7 +29,7 @@ func (s Store) String() string { } func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { - if err := os.MkdirAll(path, os.ModePerm); err != nil { + if err := os.MkdirAll(path, 0755); err != nil { return nil, err } diff --git a/store/store.go b/store/store.go index d620c03..aa4b485 100644 --- a/store/store.go +++ b/store/store.go @@ -27,7 +27,7 @@ func Open(cfg *config.Config) (*DB, error) { path := getStorePath(cfg) - if err := os.MkdirAll(path, os.ModePerm); err != nil { + if err := os.MkdirAll(path, 0755); err != nil { return nil, err }