Skip to content

Commit

Permalink
Display an error if .scwrc is too much open
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Jun 5, 2015
1 parent ffdc098 commit f32db6e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ func getConfig() (*Config, error) {
if err != nil {
return nil, err
}

stat, err := os.Stat(scwrcPath)
// we don't care if it fails, the user just won't see the warning
if err == nil {
mode := stat.Mode()
if mode&0066 != 0 {
log.Fatalf("Permissions %#o for .scwrc are too open.", mode)
}
}

file, err := ioutil.ReadFile(scwrcPath)
if err != nil {
return nil, err
Expand Down

0 comments on commit f32db6e

Please sign in to comment.