Skip to content

Commit

Permalink
Fix mode of the directory when the format is dir
Browse files Browse the repository at this point in the history
  • Loading branch information
orgrim committed May 3, 2024
1 parent df166fa commit c4c53ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,14 @@ func (d *dump) dump(fc chan<- sumFileJob) error {
d.Path = file
d.ExitCode = 0

if err := os.Chmod(file, 0600); err != nil {
var mode os.FileMode = 0600
if d.Options.Format == 'd' {
// The hardening of permissions only apply to the top level
// directory, this won't make the contents executable
mode = 0700
}

if err := os.Chmod(file, mode); err != nil {
return fmt.Errorf("could not chmod to more secure permission for %s: %s", dbname, err)
}

Expand Down

0 comments on commit c4c53ac

Please sign in to comment.