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:
parent
2470062c3d
commit
8be4466d66
1 changed files with 5 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue