1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

MDEV-15550 Add error handling for fopen

Print error message and return when fopen fails.

Closes #634
This commit is contained in:
Jia Zhouyang
2018-03-01 16:25:36 +08:00
committed by Vladislav Vaintroub
parent 00eb5bf3bb
commit 8307fb23bd

View File

@@ -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;