summaryrefslogtreecommitdiff
blob: 78343774fc29b8b4078c88c19bdd8b45d786ba4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Patch borrowed from CentOS mysql-5.0.52-mysqldump-hang-33057.patch

#### ChangeSet ####
2007-12-20 21:37:21+01:00, df@pippilotta.erinye.com 
  BUG#33057 mysql command line client slows down and uses 100% CPU when restoring dump

==== client/mysql.cc ====
2007-12-20 21:37:19+01:00, df@pippilotta.erinye.com +1 -3
  BUG#33057, avoid calling strlen() *for every single character* in the client's input

--- 1.244/client/mysql.cc	2007-12-13 02:49:10 -08:00
+++ 1.245/client/mysql.cc	2007-12-20 12:37:19 -08:00
@@ -1272,9 +1272,7 @@ static bool add_line(String &buffer,char
   if (status.add_to_history && line[0] && not_in_history(line))
     add_history(line);
 #endif
-#ifdef USE_MB
   char *end_of_line=line+(uint) strlen(line);
-#endif
 
   for (pos=out=line ; (inchar= (uchar) *pos) ; pos++)
   {
@@ -1364,7 +1362,7 @@ static bool add_line(String &buffer,char
       }
     }
     else if (!*ml_comment && !*in_string &&
-             strlen(pos) >= 10 &&
+             (end_of_line - pos) >= 10 &&
              !my_strnncoll(charset_info, (uchar*) pos, 10,
                            (const uchar*) "delimiter ", 10))
     {