Support aarch64/arm64 by using dup3 instead of dup2

This commit is contained in:
eater
2017-11-21 11:32:28 +01:00
parent 034b514679
commit dd45054b77
3 changed files with 48 additions and 15 deletions

View File

@@ -5,7 +5,6 @@ import (
"log"
"log/syslog"
"os"
"syscall"
)
type Logger struct {
@@ -52,18 +51,4 @@ func Reopen() {
Log.Notice("Reopened log file per IPC request")
}
// If there are any existing fd's (e.g. we're reopening logs), we rely
// on garbage collection to clean them up for us.
func LogRedirectStdOutToFile(logPath string) {
path = logPath
if logPath == "" {
Log.Fatal("Log Path not set")
}
logFile, err := os.OpenFile(logPath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
if err != nil {
Log.Fatal(err)
}
syscall.Dup2(int(logFile.Fd()), 1)
syscall.Dup2(int(logFile.Fd()), 2)
}