Commit 09a2292d authored by iggy@amd64.(none)'s avatar iggy@amd64.(none)
Browse files

Merge amd64.(none):/src/bug26243/my50-bug26243

into  amd64.(none):/src/bug26243/my51-bug26243
parents bdabc524 79e434bc
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -1269,12 +1269,12 @@ sig_handler handle_sigint(int sig)

  /* terminate if no query being executed, or we already tried interrupting */
  if (!executing_query || interrupted_query)
    mysql_end(sig);
    goto err;

  kill_mysql= mysql_init(kill_mysql);
  if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password,
                          "", opt_mysql_port, opt_mysql_unix_port,0))
    mysql_end(sig);
    goto err;

  /* kill_buffer is always big enough because max length of %lu is 15 */
  sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
@@ -1283,6 +1283,22 @@ sig_handler handle_sigint(int sig)
  tee_fprintf(stdout, "Query aborted by Ctrl+C\n");

  interrupted_query= 1;

  return;

err:
#ifdef _WIN32
  /*
   When SIGINT is raised on Windows, the OS creates a new thread to handle the
   interrupt. Once that thread completes, the main thread continues running 
   only to find that it's resources have already been free'd when the sigint 
   handler called mysql_end(). 
  */
  mysql_thread_end();
  return;
#else
  mysql_end(sig);
#endif  
}