summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
diff options
context:
space:
mode:
authorDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-07-21 14:56:43 +0700
committerDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-07-21 14:56:43 +0700
commit49d327ebf763dca23969ac4afe814617815d1411 (patch)
tree6fa561732c7d7b6aafd747e41417467da3cab2c9 /sql/protocol.cc
parent48a74d7472d92915c12671d2b0563df5d44614b4 (diff)
downloadmariadb-git-49d327ebf763dca23969ac4afe814617815d1411.tar.gz
Fixed bug #42496 - the server could crash on a debug assert after a failure
to write into a closed socket
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r--sql/protocol.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc
index dc53e029647..dfb78462f13 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -534,7 +534,11 @@ void Protocol::end_partial_result_set(THD *thd_arg)
bool Protocol::flush()
{
#ifndef EMBEDDED_LIBRARY
- return net_flush(&thd->net);
+ bool error;
+ thd->main_da.can_overwrite_status= TRUE;
+ error= net_flush(&thd->net);
+ thd->main_da.can_overwrite_status= FALSE;
+ return error;
#else
return 0;
#endif
@@ -574,7 +578,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
if (flags & SEND_NUM_ROWS)
{ // Packet with number of elements
uchar *pos= net_store_length(buff, list->elements);
- (void) my_net_write(&thd->net, buff, (size_t) (pos-buff));
+ if (my_net_write(&thd->net, buff, (size_t) (pos-buff)))
+ DBUG_RETURN(1);
}
#ifndef DBUG_OFF
@@ -698,7 +703,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
if (flags & SEND_DEFAULTS)
item->send(&prot, &tmp); // Send default value
if (prot.write())
- break; /* purecov: inspected */
+ DBUG_RETURN(1);
#ifndef DBUG_OFF
field_types[count++]= field.type;
#endif
@@ -711,7 +716,9 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
to show that there is no cursor.
Send no warning information, as it will be sent at statement end.
*/
- write_eof_packet(thd, &thd->net, thd->server_status, thd->total_warn_count);
+ if (write_eof_packet(thd, &thd->net, thd->server_status,
+ thd->total_warn_count))
+ DBUG_RETURN(1);
}
DBUG_RETURN(prepare_for_send(list));