Fix bbolt command-line commands to open a bbolt database with file mode: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>
This commit is contained in:
Ishan Tyagi 2023-07-29 18:35:00 +05:30 committed by ishan16696
parent c0b6749ca4
commit 65759b6c75

View File

@ -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,
})
@ -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
}
@ -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,
})
@ -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
}
@ -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
}
@ -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
}
@ -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
}
@ -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
}
@ -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
}