mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
fix DirIsAccessible
perms 0000 need to be checked explicitly
This commit is contained in:
+2
-2
@@ -10,13 +10,13 @@ import (
|
|||||||
|
|
||||||
// DirIsAccessible verifies that directory exists and is accessible
|
// DirIsAccessible verifies that directory exists and is accessible
|
||||||
func DirIsAccessible(filename string) error {
|
func DirIsAccessible(filename string) error {
|
||||||
_, err := os.Stat(filename)
|
fileStat, err := os.Stat(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
return fmt.Errorf("error checking directory '%s': %s", filename, err)
|
return fmt.Errorf("error checking directory '%s': %s", filename, err)
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
return fmt.Errorf("'%s' is inaccessible, check access rights", filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user