Skip to content

Commit

Permalink
Merge pull request #1048 from pi-hole/fix/status_14_warning
Browse files Browse the repository at this point in the history
Fixes incorrect "Found unknown status 14 in long term database" warning
  • Loading branch information
DL6ER authored Jan 31, 2021
2 parents d4cb03c + 6ab9b70 commit c355e85
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/database/query-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,13 @@ void DB_read_queries(void)
continue;
}

const int status = sqlite3_column_int(stmt, 3);
if(status < QUERY_UNKNOWN || status >= QUERY_STATUS_MAX)
const int status_int = sqlite3_column_int(stmt, 3);
if(status_int < QUERY_UNKNOWN || status_int >= QUERY_STATUS_MAX)
{
logg("FTL_db warn: STATUS should be within [%i,%i] but is %i", QUERY_UNKNOWN, QUERY_STATUS_MAX-1, status);
logg("FTL_db warn: STATUS should be within [%i,%i] but is %i", QUERY_UNKNOWN, QUERY_STATUS_MAX-1, status_int);
continue;
}
const enum query_status status = status_int;

const char * domainname = (const char *)sqlite3_column_text(stmt, 4);
if(domainname == NULL)
Expand Down Expand Up @@ -535,9 +536,11 @@ void DB_read_queries(void)

case QUERY_RETRIED: // Retried query
case QUERY_RETRIED_DNSSEC: // fall through
case QUERY_IN_PROGRESS:
// Nothing to be done here
break;

case QUERY_STATUS_MAX:
default:
logg("Warning: Found unknown status %i in long term database!", status);
break;
Expand Down

0 comments on commit c355e85

Please sign in to comment.