summaryrefslogtreecommitdiff
path: root/client/mysql_plugin.c
diff options
context:
space:
mode:
authorJia Zhouyang <jiazhouyang@nudt.edu.cn>2018-03-01 16:25:36 +0800
committerVladislav Vaintroub <wlad@mariadb.com>2018-05-21 16:34:10 +0000
commit8307fb23bd5646568044cb75abc5e505c47d312a (patch)
treecf516622a8293f8e8e54a020091d20575bca46fe /client/mysql_plugin.c
parent00eb5bf3bb81b29e582a2f030735d40c6721900d (diff)
downloadmariadb-git-8307fb23bd5646568044cb75abc5e505c47d312a.tar.gz
MDEV-15550 Add error handling for fopen
Print error message and return when fopen fails. Closes #634
Diffstat (limited to 'client/mysql_plugin.c')
-rw-r--r--client/mysql_plugin.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 81677ad551f..d297f3cd03e 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -365,6 +365,12 @@ static int get_default_values()
}
/* Now open the file and read the defaults we want. */
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)
{
char *value= 0;