Skip to content

Commit

Permalink
fix DirIsAccessible
Browse files Browse the repository at this point in the history
perms 0000 need to be checked explicitly
  • Loading branch information
neolynx committed Jul 24, 2024
1 parent 4a0bdcb commit deae904
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (

// DirIsAccessible verifies that directory exists and is accessible
func DirIsAccessible(filename string) error {
_, err := os.Stat(filename)
fileStat, err := os.Stat(filename)
if err != nil {
if !os.IsNotExist(err) {
return fmt.Errorf("error checking directory '%s': %s", filename, err)
}
} else {
if unix.Access(filename, unix.W_OK) != nil {
if fileStat.Mode().Perm() == 0000 || unix.Access(filename, unix.W_OK) != nil {
return fmt.Errorf("'%s' is inaccessible, check access rights", filename)
}
}
Expand Down

0 comments on commit deae904

Please sign in to comment.