[mod_pgsql] Coverity: 1227660 Logically dead code

This commit is contained in:
Andrey Volk 2023-10-05 18:05:32 +03:00 committed by GitHub
parent d08424384b
commit f5a41d3092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -113,7 +113,7 @@ static int db_is_up(switch_pgsql_handle_t *handle)
char *err_str = NULL; char *err_str = NULL;
int max_tries = DEFAULT_PGSQL_RETRIES; int max_tries = DEFAULT_PGSQL_RETRIES;
int code = 0; int code = 0;
int recon = 0; switch_status_t recon = SWITCH_STATUS_FALSE;
switch_byte_t sanity = 255; switch_byte_t sanity = 255;
if (handle) { if (handle) {
@ -128,6 +128,7 @@ top:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Handle\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Handle\n");
goto done; goto done;
} }
if (!handle->con) { if (!handle->con) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Connection\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Connection\n");
goto done; goto done;
@ -141,6 +142,7 @@ top:
switch_yield(1); switch_yield(1);
continue; continue;
} }
break; break;
} }
@ -158,6 +160,7 @@ reset:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "PQstatus returned bad connection -- reconnection failed!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "PQstatus returned bad connection -- reconnection failed!\n");
goto error; goto error;
} }
handle->state = SWITCH_PGSQL_STATE_CONNECTED; handle->state = SWITCH_PGSQL_STATE_CONNECTED;
handle->sock = PQsocket(handle->con); handle->sock = PQsocket(handle->con);
} }
@ -193,6 +196,7 @@ error:
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Additional-Info", "The connection could not be re-established"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Additional-Info", "The connection could not be re-established");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The connection could not be re-established\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The connection could not be re-established\n");
} }
if (!max_tries) { if (!max_tries) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Additional-Info", "Giving up!"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Additional-Info", "Giving up!");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Giving up!\n");