Log error if config file cannot be closed

This commit is contained in:
Paul-Christian Volkmer 2024-10-25 18:45:21 +02:00
parent 43719eba8b
commit f6d8bce2d5

View File

@ -109,7 +109,12 @@ func configure(configFile string) {
log.Printf("Invalid configuration file '%s' - ignore it.\n", configFile) log.Printf("Invalid configuration file '%s' - ignore it.\n", configFile)
} }
defer file.Close() defer func(file *os.File) {
err := file.Close()
if err != nil {
log.Printf("Cannot close config file")
}
}(file)
config = *c config = *c
} }