Commit b5f18a59 authored by unknown's avatar unknown

Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"

- Detect read failure in my_read_charset_file


mysys/charset.c:
  Use my_read instead of read(), and detect read failure, in my_read_charset_file()
parent e56afda4
......@@ -312,7 +312,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
{
char *buf;
int fd;
uint len;
uint len, tmp_len;
MY_STAT stat_info;
if (!my_stat(filename, &stat_info, MYF(myflags)) ||
......@@ -321,12 +321,11 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
return TRUE;
if ((fd=my_open(filename,O_RDONLY,myflags)) < 0)
{
my_free(buf,myflags);
return TRUE;
}
len=read(fd,buf,len);
goto error;
tmp_len=my_read(fd, buf, len, myflags);
my_close(fd,myflags);
if (tmp_len != len)
goto error;
if (my_parse_charset_xml(buf,len,add_collation))
{
......@@ -340,6 +339,10 @@ static my_bool my_read_charset_file(const char *filename, myf myflags)
my_free(buf, myflags);
return FALSE;
error:
my_free(buf, myflags);
return TRUE;
}
......
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