summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-12-08 17:04:57 +0200
committermonty@donna.mysql.com <>2000-12-08 17:04:57 +0200
commit7617d198a4b6147a2f09b0749ad7ebedb76227b4 (patch)
treeb351c53cc8d10719148a114a60853aa9347782e0 /sql/hostname.cc
parentc475a9885d88155c2efcf44423c69df76386ac79 (diff)
downloadmariadb-git-7617d198a4b6147a2f09b0749ad7ebedb76227b4.tar.gz
Lots of fixes for BDB tables
Change DROP TABLE to first drop the data, then the .frm file
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index db8f8349446..1c52a5363d3 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -81,10 +81,12 @@ static void add_hostname(struct in_addr *in,const char *name)
if ((entry=(host_entry*) malloc(sizeof(host_entry)+length+1)))
{
- char *new_name= (char *) (entry+1);
+ char *new_name;
memcpy_fixed(&entry->ip, &in->s_addr, sizeof(in->s_addr));
- memcpy(new_name, name, length); // Should work even if name == NULL
- new_name[length]=0; // End of string
+ if (length)
+ memcpy(new_name= (char *) (entry+1), name, length+1);
+ else
+ new_name=0;
entry->hostname=new_name;
entry->errors=0;
(void) hostname_cache->add(entry);