mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
fix DirIsAccessible
perms 0000 need to be checked explicitly
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user