1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-06-17 04:50:02 +02:00

src/main.go: in setLogFile() check for null when closing old FD and also check error from Close()

This commit is contained in:
Henrik Hautakoski 2021-12-24 11:05:47 +01:00
parent 2470062c3d
commit 8be4466d66

View file

@ -54,9 +54,11 @@ func setLogFile() {
log.Error(err.Error())
}
// Close old one (if open)
if logfd.Fd() < 0 {
logfd.Close()
// Try close if old descriptor is defined.
if logfd != nil {
if err = logfd.Close(); err != nil {
log.Error(err.Error())
}
}
// Update variable and set log writer.