summaryrefslogtreecommitdiff
path: root/mysys/charset.c
diff options
context:
space:
mode:
authortsmith/tim@siva.hindu.god <>2006-09-14 21:06:14 -0600
committertsmith/tim@siva.hindu.god <>2006-09-14 21:06:14 -0600
commit5ec2bfe94c28ad73a691d90b784138f38e9134cd (patch)
tree6a6c6d9cb46162d68a20659ad5334f4961be694c /mysys/charset.c
parentb6cd727ed1f722ae37f9302196f6f20121bbbb4d (diff)
downloadmariadb-git-5ec2bfe94c28ad73a691d90b784138f38e9134cd.tar.gz
Bug #4053: too many of "error 1236: 'binlog truncated in the middle of event' from master"
- Detect read failure in my_read_charset_file
Diffstat (limited to 'mysys/charset.c')
-rw-r--r--mysys/charset.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mysys/charset.c b/mysys/charset.c
index 665f2efecd8..6f2d4d3c347 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -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;
}