Skip to content

Commit

Permalink
Fix bbolt command-line commands to open a bbolt database with file mo…
Browse files Browse the repository at this point in the history
…de:0600 instead of 0666.

Fix bbolt command-line command: compact to open a bbolt database with file mode:0400 instead of 0444

Signed-off-by: Ishan Tyagi <ishantyagi25@gmail.com>
  • Loading branch information
ishan16696 committed Jul 29, 2023
1 parent c0b6749 commit 65759b6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmd/bbolt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (cmd *checkCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{
db, err := bolt.Open(path, 0600, &bolt.Options{
ReadOnly: true,
PreLoadFreelist: true,
})
Expand Down Expand Up @@ -284,7 +284,7 @@ func (cmd *infoCommand) Run(args ...string) error {
}

// Open the database.
db, err := bolt.Open(path, 0666, &bolt.Options{ReadOnly: true})
db, err := bolt.Open(path, 0600, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down Expand Up @@ -644,7 +644,7 @@ func (cmd *pagesCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{
db, err := bolt.Open(path, 0600, &bolt.Options{
ReadOnly: true,
PreLoadFreelist: true,
})
Expand Down Expand Up @@ -737,7 +737,7 @@ func (cmd *statsCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{ReadOnly: true})
db, err := bolt.Open(path, 0600, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down Expand Up @@ -868,7 +868,7 @@ func (cmd *bucketsCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{ReadOnly: true})
db, err := bolt.Open(path, 0600, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down Expand Up @@ -929,7 +929,7 @@ func (cmd *keysCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{ReadOnly: true})
db, err := bolt.Open(path, 0600, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down Expand Up @@ -1020,7 +1020,7 @@ func (cmd *getCommand) Run(args ...string) error {
}

// Open database.
db, err := bolt.Open(path, 0666, &bolt.Options{ReadOnly: true})
db, err := bolt.Open(path, 0600, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down Expand Up @@ -1097,7 +1097,7 @@ func (cmd *benchCommand) Run(args ...string) error {
}

// Create database.
db, err := bolt.Open(options.Path, 0666, nil)
db, err := bolt.Open(options.Path, 0600, nil)
if err != nil {
return err
}
Expand Down Expand Up @@ -1652,7 +1652,7 @@ func (cmd *compactCommand) Run(args ...string) (err error) {
initialSize := fi.Size()

// Open source database.
src, err := bolt.Open(cmd.SrcPath, 0444, &bolt.Options{ReadOnly: true})
src, err := bolt.Open(cmd.SrcPath, 0400, &bolt.Options{ReadOnly: true})
if err != nil {
return err
}
Expand Down

0 comments on commit 65759b6

Please sign in to comment.