Fix glibc crash: add log message on fopen failure

glibc's fclose implementation does not do a NULL check and will crash on "fclose(NULL)". A bunch of Fedora users have been sending in traces for this issue. I've added a log on failure case, likely if the user does not have permission to write to the file.
This commit is contained in:
Jeremy Newton 2017-04-17 14:41:50 -04:00 committed by Rafael Kitover
parent b59b7b394c
commit 1ba2eefebe
1 changed files with 4 additions and 0 deletions

View File

@ -758,6 +758,10 @@ void SaveConfigFile()
if (configFile != NULL)
{
FILE *f = fopen(configFile, "w");
if (f == NULL) {
log("Configuration file could not be opened %s\n", optarg);
return;
}
// Needs mixed case version of the option name to add new options into the ini
//for (int i = 0; i < (sizeof(argOptions) / sizeof(option)); i++)
//{