1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

IM port fixes: fix crash on startup, add more error checking, get rid of unnecessary code.

server-tools/instance-manager/commands.cc:
  fix memory leak
server-tools/instance-manager/guardian.cc:
  don't check pthread_mutex_lock/unlock return value, as it never returns error if properly
  used (no self deadlocks) and initialized
server-tools/instance-manager/guardian.h:
  prototype fixed
server-tools/instance-manager/instance_map.cc:
  don't check pthread_mutex_lock/unlock status, as it never returns error if
  properly used (no self deadlocks) and initialized
server-tools/instance-manager/instance_map.h:
  prototype fixed
server-tools/instance-manager/listener.cc:
  initialize highest-numbered descriptor to 0 for select before setting it with max(n, sockets[i]),
  ifdef unix-specific code
server-tools/instance-manager/manager.cc:
  remove commented stuff
server-tools/instance-manager/options.cc:
  fix crash in load_defaults, which happened on all Unix systems due to
  const char *Options::config_file= NULL. Check return value for GetModuleFileName.
  Get rid of obscure default_config_file[FN_REFLEN]= "/etc/my.cnf"; which was never used
This commit is contained in:
unknown
2005-08-05 14:35:30 +04:00
parent c5bcb9f01c
commit 85834c3b03
8 changed files with 39 additions and 46 deletions

View File

@@ -471,6 +471,7 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
int read_len;
/* calculate buffer size */
MY_STAT file_stat;
Buffer read_buff;
/* my_fstat doesn't use the flag parameter */
if (my_fstat(fd, &file_stat, MYF(0)))
@@ -478,13 +479,16 @@ int Show_instance_log::execute(struct st_net *net, ulong connection_id)
buff_size= (size - offset);
read_buff.reserve(0, buff_size);
/* read in one chunk */
read_len= my_seek(fd, file_stat.st_size - size, MY_SEEK_SET, MYF(0));
char *bf= (char*) malloc(sizeof(char)*buff_size);
if ((read_len= my_read(fd, (byte*)bf, buff_size, MYF(0))) < 0)
if ((read_len= my_read(fd, (byte*) read_buff.buffer,
buff_size, MYF(0))) < 0)
return ER_READ_FILE;
store_to_protocol_packet(&send_buff, (char*) bf, &position, read_len);
store_to_protocol_packet(&send_buff, read_buff.buffer,
&position, read_len);
close(fd);
}
else