mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
fix
This commit is contained in:
parent
13f4b57997
commit
8ccc8bb1d7
@ -61,26 +61,20 @@ func newAutoRedirect(t *Tun) (*tunAutoRedirect, error) {
|
|||||||
suPath string
|
suPath string
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if t.platformInterface != nil {
|
for _, suPath = range []string{
|
||||||
suPaths := []string{
|
"su",
|
||||||
"/bin/su",
|
|
||||||
"/system/bin/su",
|
"/system/bin/su",
|
||||||
}
|
} {
|
||||||
for _, path := range suPaths {
|
suPath, err = exec.LookPath(suPath)
|
||||||
suPath, err = exec.LookPath(path)
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
if err != nil {
|
||||||
suPath, err = exec.LookPath("su")
|
|
||||||
}
|
|
||||||
if err == nil {
|
|
||||||
s.androidSu = true
|
|
||||||
s.suPath = suPath
|
|
||||||
} else {
|
|
||||||
return nil, E.Extend(E.Cause(err, "root permission is required for auto redirect"), os.Getenv("PATH"))
|
return nil, E.Extend(E.Cause(err, "root permission is required for auto redirect"), os.Getenv("PATH"))
|
||||||
}
|
}
|
||||||
|
s.androidSu = true
|
||||||
|
s.suPath = suPath
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := s.initializeNfTables()
|
err := s.initializeNfTables()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user