change open file and mkdir mode

open file use 0644
mkdir use 0755
This commit is contained in:
siddontang 2014-09-13 23:06:36 +08:00
parent 9d00aa229d
commit 39d6db56bd
9 changed files with 10 additions and 10 deletions

View File

@ -23,7 +23,7 @@ func main() {
var err error var err error
var f *os.File 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()) println(err.Error())
return return
} }

View File

@ -117,7 +117,7 @@ func NewBinLog(cfg *config.Config) (*BinLog, error) {
l.path = path.Join(cfg.DataDir, "binlog") 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 return nil, err
} }

View File

@ -38,7 +38,7 @@ func (m *MasterInfo) Save(filePath string) error {
filePathBak := fmt.Sprintf("%s.bak", filePath) filePathBak := fmt.Sprintf("%s.bak", filePath)
var fd *os.File 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 { if err != nil {
return err return err
} }
@ -250,7 +250,7 @@ func (m *master) fullSync() error {
} }
dumpPath := path.Join(m.app.cfg.DataDir, "master.dump") 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 { if err != nil {
return err return err
} }

View File

@ -18,7 +18,7 @@ func (s Store) String() string {
} }
func (s Store) Open(dbPath string, cfg *config.Config) (driver.IDB, error) { 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") name := path.Join(dbPath, "ledis_bolt.db")
db := new(DB) db := new(DB)
var err error var err error

View File

@ -47,7 +47,7 @@ type DB struct {
} }
func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { 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 return nil, err
} }

View File

@ -28,7 +28,7 @@ func (s Store) String() string {
} }
func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { 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 return nil, err
} }

View File

@ -28,7 +28,7 @@ func (s Store) String() string {
} }
func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { 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 return nil, err
} }

View File

@ -29,7 +29,7 @@ func (s Store) String() string {
} }
func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) { 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 return nil, err
} }

View File

@ -27,7 +27,7 @@ func Open(cfg *config.Config) (*DB, error) {
path := getStorePath(cfg) path := getStorePath(cfg)
if err := os.MkdirAll(path, os.ModePerm); err != nil { if err := os.MkdirAll(path, 0755); err != nil {
return nil, err return nil, err
} }