GUAC-622: Just log normal error messages if guac_error not set. Init guac_error before plugin load.

This commit is contained in:
Michael Jumper 2014-04-14 12:01:36 -07:00
parent 3823165d7f
commit e1ac588296
2 changed files with 40 additions and 20 deletions

View File

@ -66,6 +66,10 @@ void guacd_handle_connection(guac_socket* socket) {
guac_instruction* connect; guac_instruction* connect;
int init_result; int init_result;
/* Reset guac_error */
guac_error = GUAC_STATUS_SUCCESS;
guac_error_message = NULL;
/* Get protocol from select instruction */ /* Get protocol from select instruction */
select = guac_instruction_expect( select = guac_instruction_expect(
socket, GUACD_USEC_TIMEOUT, "select"); socket, GUACD_USEC_TIMEOUT, "select");

View File

@ -89,6 +89,8 @@ void guacd_client_log_error(guac_client* client, const char* format,
void guacd_log_guac_error(const char* message) { void guacd_log_guac_error(const char* message) {
if (guac_error != GUAC_STATUS_SUCCESS) {
/* If error message provided, include in log */ /* If error message provided, include in log */
if (guac_error_message != NULL) if (guac_error_message != NULL)
guacd_log_error("%s: %s: %s", guacd_log_error("%s: %s: %s",
@ -104,8 +106,16 @@ void guacd_log_guac_error(const char* message) {
} }
/* Just log message if no status code */
else
guacd_log_error("%s", message);
}
void guacd_client_log_guac_error(guac_client* client, const char* message) { void guacd_client_log_guac_error(guac_client* client, const char* message) {
if (guac_error != GUAC_STATUS_SUCCESS) {
/* If error message provided, include in log */ /* If error message provided, include in log */
if (guac_error_message != NULL) if (guac_error_message != NULL)
guac_client_log_error(client, "%s: %s: %s", guac_client_log_error(client, "%s: %s: %s",
@ -121,3 +131,9 @@ void guacd_client_log_guac_error(guac_client* client, const char* message) {
} }
/* Just log message if no status code */
else
guac_client_log_error(client, "%s", message);
}