mode use 0644 for file, 0755 for dir

This commit is contained in:
siddontang 2014-09-18 21:27:43 +08:00
parent fafd0c7e80
commit 0a72481eb0
9 changed files with 12 additions and 12 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
} }
@ -136,7 +136,7 @@ func (l *BinLog) flushIndex() error {
data := strings.Join(l.logNames, "\n") data := strings.Join(l.logNames, "\n")
bakName := fmt.Sprintf("%s.bak", l.indexName) bakName := fmt.Sprintf("%s.bak", l.indexName)
f, err := os.OpenFile(bakName, os.O_WRONLY|os.O_CREATE, 0666) f, err := os.OpenFile(bakName, os.O_WRONLY|os.O_CREATE, 0644)
if err != nil { if err != nil {
log.Error("create binlog bak index error %s", err.Error()) log.Error("create binlog bak index error %s", err.Error())
return err return err
@ -217,7 +217,7 @@ func (l *BinLog) openNewLogFile() error {
lastName := l.getLogFile() lastName := l.getLogFile()
logPath := path.Join(l.path, lastName) logPath := path.Join(l.path, lastName)
if l.logFile, err = os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY, 0666); err != nil { if l.logFile, err = os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY, 0644); err != nil {
log.Error("open new logfile error %s", err.Error()) log.Error("open new logfile error %s", err.Error())
return err return 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
} }