Commit d7a047c4 authored by Jia Zhouyang's avatar Jia Zhouyang Committed by Vladislav Vaintroub

MDEV-15550 Add error handling for fopen

Print error message and return when fopen fails.

Closes #634
parent b5a6f823
...@@ -365,6 +365,12 @@ static int get_default_values() ...@@ -365,6 +365,12 @@ static int get_default_values()
} }
/* Now open the file and read the defaults we want. */ /* Now open the file and read the defaults we want. */
file= fopen(defaults_file, "r"); file= fopen(defaults_file, "r");
if (file == NULL)
{
fprintf(stderr, "ERROR: failed to open file %s: %s.\n", defaults_file,
strerror(errno));
goto exit;
}
while (fgets(line, FN_REFLEN, file) != NULL) while (fgets(line, FN_REFLEN, file) != NULL)
{ {
char *value= 0; char *value= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment