[#727] util: Add MkdirAllX func

Add `MkdirAllX` function that wraps `os.MkdirAll`
and adds `x` permission for user and group.
This is used to make all created dirs openable
for user and group regardless of the read config
permissions.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-07-28 19:18:38 +03:00 committed by Alex Vanin
parent c332188341
commit 51eeae3640

10
pkg/util/os.go Normal file
View file

@ -0,0 +1,10 @@
package util
import "os"
// MkdirAllX calls os.MkdirAll with passed permissions
// but with +x for user and group. This makes created
// dir openable regardless of the passed permissions.
func MkdirAllX(path string, perm os.FileMode) error {
return os.MkdirAll(path, perm|0110)
}