Skip to content

Commit f37d7f1

Browse files
committed
lint: force use keepalive fd unused var
1 parent 5e7bb93 commit f37d7f1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

intra/tun2socks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ func setCrashFd(f *os.File) (ok bool) {
432432
return err == nil
433433
}
434434

435-
var panicfd *os.File
435+
var panicfd atomic.Pointer[os.File]
436436

437437
func setPanicFd(f *os.File) bool {
438-
panicfd = f // keepalive
438+
panicfd.Store(f) // keepalive
439439
return log.StackOutput(f)
440440
}
441441

@@ -448,7 +448,7 @@ func SetCrashOutput(fp1, fp2 string) bool {
448448
if err == nil && err2 == nil {
449449
ok = setCrashFd(fout1) && setPanicFd(fout2)
450450
}
451-
logei(err)("tun: crashout: open: %s + %s; err? %v", fp1, fp2, err)
451+
logei(err)("tun: crashout: open: %s (%s) + %s (%s); err? %v", fp1, fname(fout2), fp2, fname(panicfd.Load()), err)
452452
return ok
453453
})()
454454
}

0 commit comments

Comments
 (0)