mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Avoid chown instead fallback to rootpath for user perms (#7874)
Fixes #7864
This commit is contained in:
parent
bd56f80250
commit
0ebbd3caef
@ -22,7 +22,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
|
||||||
"os/user"
|
"os/user"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
@ -43,13 +42,13 @@ func getUserGroup(path string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// Fresh directory we should default to what was requested by user.
|
// Fresh directory we should default to what was requested by user.
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
cmd := exec.Command("chown", "-R", defaultUserGroup, path)
|
fi, err = os.Stat(path)
|
||||||
if err = cmd.Run(); err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return defaultUserGroup, nil
|
} else {
|
||||||
|
return "", err
|
||||||
}
|
}
|
||||||
return "", err
|
|
||||||
}
|
}
|
||||||
stat, ok := fi.Sys().(*syscall.Stat_t)
|
stat, ok := fi.Sys().(*syscall.Stat_t)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user