~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_unix_socket_protocol/protocol.cc

  • Committer: Brian Aker
  • Date: 2010-10-29 00:28:10 UTC
  • mto: (1890.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1891.
  • Revision ID: brian@tangent.org-20101029002810-zij3rcrub02z3bqa
Possible fix for warning on bind().

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
bool Protocol::getFileDescriptors(std::vector<int> &fds)
80
80
{
81
81
  struct sockaddr_un servAddr;
 
82
  socklen_t addrlen;
82
83
  int unix_sock;
83
84
 
84
85
  if ((unix_sock= socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
97
98
 
98
99
  (void) setsockopt(unix_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, sizeof(arg));
99
100
 
100
 
  if (bind(unix_sock, reinterpret_cast<struct sockaddr *>(&servAddr), sizeof(servAddr)) < 0)
 
101
  addrlen= sizeof(servAddr);
 
102
  if (bind(unix_sock, reinterpret_cast<struct sockaddr *>(&servAddr), addrlen) < 0)
101
103
  { 
102
104
    std::cerr << "Can't start server : Bind on unix socket\n";
103
105
    std::cerr << "Do you already have another of drizzled or mysqld running on socket: " << "/tmp/mysql.socket" << "?\n";