mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +00:00
platform: Fix crash on android
This commit is contained in:
parent
1402bdab41
commit
c84c18f960
|
@ -4,6 +4,7 @@ package libbox
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
@ -18,12 +19,14 @@ func RedirectStderr(path string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if sUserID > 0 {
|
if runtime.GOOS != "android" {
|
||||||
err = outputFile.Chown(sUserID, sGroupID)
|
if sUserID > 0 {
|
||||||
if err != nil {
|
err = outputFile.Chown(sUserID, sGroupID)
|
||||||
outputFile.Close()
|
if err != nil {
|
||||||
os.Remove(outputFile.Name())
|
outputFile.Close()
|
||||||
return err
|
os.Remove(outputFile.Name())
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = unix.Dup2(int(outputFile.Fd()), int(os.Stderr.Fd()))
|
err = unix.Dup2(int(outputFile.Fd()), int(os.Stderr.Fd()))
|
||||||
|
|
Loading…
Reference in a new issue