On 12/26/2016 01:45 AM, Wietse Venema wrote: > I see room for two improvements: > - Don't loop on mysql_next_result() if that function returns an > error, to avoid going into an infinite loop. A break is needed in the case of >0 return code from mysql_next_result.
while ((next_res_status = mysql_next_result(host->db)) >= 0) { if (next_res_status > 0) { SET_ERROR_AND_WARN_ONCE(query_error, "mysql query failed (mysql_next_result): %s", mysql_error(host->db)); + break; } > - Do call mysql_next_result() after mysql_store_result() etc. error > just to be sure that we stay in sync. This won't log any Postfix > warnings when the query_error flag was already raised. so long as the loop continues in the presence of a zero return code from mysql_next_result() and mysql_store_result is called for each one we will stay in sync. With the break above we will be ok, since the loop stops only when there are no more results -1 normal condition from mysql_next_result or >0 error condition from mysql_next_result via the break. > Wietse