Make sure config file is closed after dumping configuration

reverse-scroll
nirenjan 2021-08-30 10:28:26 -07:00
parent 38dfc7d7b0
commit 76b1b99717
1 changed files with 4 additions and 2 deletions

View File

@ -152,11 +152,13 @@ int x52d_config_save_file(struct x52d_config *cfg, const char *cfg_file)
if (rc) { \ if (rc) { \
PINELOG_ERROR(_("Failed to dump %s.%s to config file %s - code %d: %s"), \ PINELOG_ERROR(_("Failed to dump %s.%s to config file %s - code %d: %s"), \
#section, #key, cfg_file, rc, strerror(rc)); \ #section, #key, cfg_file, rc, strerror(rc)); \
return rc; \ goto exit_dump; \
} \ } \
} while (0); } while (0);
#include "x52d_config.def" #include "x52d_config.def"
return 0; exit_dump:
fclose(cfg_fp);
return rc;
} }