Update file permissions.
parent
8cb7be45cc
commit
96748cb217
|
@ -135,13 +135,13 @@ func (b *Broker) Open(path string) error {
|
|||
b.path = path
|
||||
|
||||
// Ensure root directory exists.
|
||||
if err := os.MkdirAll(path, 0700); err != nil {
|
||||
if err := os.MkdirAll(path, 0777); err != nil {
|
||||
b.close()
|
||||
return fmt.Errorf("mkdir: %s", err)
|
||||
}
|
||||
|
||||
// Open meta file.
|
||||
meta, err := bolt.Open(b.metaPath(), 0600, &bolt.Options{Timeout: 1 * time.Second})
|
||||
meta, err := bolt.Open(b.metaPath(), 0666, &bolt.Options{Timeout: 1 * time.Second})
|
||||
if err != nil {
|
||||
b.close()
|
||||
return fmt.Errorf("open meta: %s", err)
|
||||
|
@ -359,7 +359,7 @@ func (b *Broker) Restore(r io.Reader) error {
|
|||
// Remove and recreate broker path.
|
||||
if err := b.reset(); err != nil && !os.IsNotExist(err) {
|
||||
return fmt.Errorf("reset: %s", err)
|
||||
} else if err = os.MkdirAll(b.path, 0700); err != nil {
|
||||
} else if err = os.MkdirAll(b.path, 0777); err != nil {
|
||||
return fmt.Errorf("mkdir: %s", err)
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ func (b *Broker) Restore(r io.Reader) error {
|
|||
t := NewTopic(st.ID, b.topicPath(st.ID))
|
||||
|
||||
// Create topic directory.
|
||||
if err := os.MkdirAll(t.Path(), 0700); err != nil {
|
||||
if err := os.MkdirAll(t.Path(), 0777); err != nil {
|
||||
return fmt.Errorf("make topic dir: %s", err)
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ func (t *Topic) Open() error {
|
|||
t.opened = true
|
||||
|
||||
// Ensure the parent directory exists.
|
||||
if err := os.MkdirAll(t.path, 0700); err != nil {
|
||||
if err := os.MkdirAll(t.path, 0777); err != nil {
|
||||
t.close()
|
||||
return err
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ func (t *Topic) Open() error {
|
|||
t.index = index
|
||||
|
||||
// Open file handle on the segment.
|
||||
f, err := os.OpenFile(s.Path, os.O_RDWR|os.O_APPEND, 0600)
|
||||
f, err := os.OpenFile(s.Path, os.O_RDWR|os.O_APPEND, 0666)
|
||||
if err != nil {
|
||||
t.close()
|
||||
return fmt.Errorf("open segment: %s", err)
|
||||
|
@ -776,7 +776,7 @@ func (t *Topic) WriteMessage(m *Message) error {
|
|||
|
||||
// Create a new segment if we have no handle.
|
||||
if t.file == nil {
|
||||
f, err := os.OpenFile(t.segmentPath(m.Index), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
f, err := os.OpenFile(t.segmentPath(m.Index), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
|
||||
if err != nil {
|
||||
return fmt.Errorf("create segment file: %s", err)
|
||||
}
|
||||
|
|
|
@ -751,10 +751,10 @@ func tempfile() string {
|
|||
|
||||
// MustWriteFile writes data to a file. Panic on error.
|
||||
func MustWriteFile(filename string, data []byte) {
|
||||
if err := os.MkdirAll(filepath.Dir(filename), 0700); err != nil {
|
||||
if err := os.MkdirAll(filepath.Dir(filename), 0777); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
if err := ioutil.WriteFile(filename, data, 0600); err != nil {
|
||||
if err := ioutil.WriteFile(filename, data, 0666); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ type metastore struct {
|
|||
// open initializes the metastore.
|
||||
func (m *metastore) open(path string) error {
|
||||
// Open the bolt-backed database.
|
||||
db, err := bolt.Open(path, 0600, &bolt.Options{Timeout: 1 * time.Second})
|
||||
db, err := bolt.Open(path, 0666, &bolt.Options{Timeout: 1 * time.Second})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -407,7 +407,7 @@ func (l *Log) readID() (uint64, error) {
|
|||
// writeID writes the log identifier to file.
|
||||
func (l *Log) writeID(id uint64) error {
|
||||
b := []byte(strconv.FormatUint(id, 10))
|
||||
return ioutil.WriteFile(l.idPath(), b, 0600)
|
||||
return ioutil.WriteFile(l.idPath(), b, 0666)
|
||||
}
|
||||
|
||||
// readTerm reads the log term from file.
|
||||
|
@ -432,7 +432,7 @@ func (l *Log) readTerm() (uint64, error) {
|
|||
// writeTerm writes the current log term to file.
|
||||
func (l *Log) writeTerm(term uint64) error {
|
||||
b := []byte(strconv.FormatUint(term, 10))
|
||||
return ioutil.WriteFile(l.termPath(), b, 0600)
|
||||
return ioutil.WriteFile(l.termPath(), b, 0666)
|
||||
}
|
||||
|
||||
// readConfig reads the configuration from disk.
|
||||
|
|
2
shard.go
2
shard.go
|
@ -76,7 +76,7 @@ func (s *Shard) open(path string, conn MessagingConn) error {
|
|||
}
|
||||
|
||||
// Open store on shard.
|
||||
store, err := bolt.Open(path, 0600, &bolt.Options{Timeout: 1 * time.Second})
|
||||
store, err := bolt.Open(path, 0666, &bolt.Options{Timeout: 1 * time.Second})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue