1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-api-healthcheck synced 2026-07-04 12:03:43 +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()) log.Error(err.Error())
} }
// Close old one (if open) // Try close if old descriptor is defined.
if logfd.Fd() < 0 { if logfd != nil {
logfd.Close() if err = logfd.Close(); err != nil {
log.Error(err.Error())
}
} }
// Update variable and set log writer. // Update variable and set log writer.