X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fctx.go;h=58dba44df6156381216ee90e5043587d9b538039;hb=2b331a082bb710d1e5a529ed32dcbba0a2e843cb;hp=7e4d726751f149963fb189dfa5df46bc03727581;hpb=c6f776e18bfcf99a841a2d74ac959bd2b18d5561;p=nncp.git diff --git a/src/ctx.go b/src/ctx.go index 7e4d726..58dba44 100644 --- a/src/ctx.go +++ b/src/ctx.go @@ -23,6 +23,8 @@ import ( "io/ioutil" "os" "path/filepath" + "strconv" + "strings" "syscall" ) @@ -135,6 +137,18 @@ func CtxFromCmdline( } else { ctx.LogPath = logPath } + if strings.HasPrefix(ctx.LogPath, LogFdPrefix) { + ptr, err := strconv.ParseUint( + strings.TrimPrefix(ctx.LogPath, LogFdPrefix), 10, 64, + ) + if err != nil { + return nil, err + } + LogFd = os.NewFile(uintptr(ptr), CfgLogEnv) + if LogFd == nil { + return nil, errors.New("can not open:" + ctx.LogPath) + } + } if showPrgrs { ctx.ShowPrgrs = true }