rest: add dbi query checks in og_set_client_mode

Check if the the execution of the main SQL query is not
successfull.
master
Alejandro Sirgo Rica 2024-07-15 10:09:02 +02:00
parent 3bfdf6b477
commit d6284b6138
1 changed files with 8 additions and 0 deletions

View File

@ -1337,6 +1337,14 @@ static int og_set_client_mode(struct og_dbi *dbi, const char *mac,
"WHERE ordenadores.mac='%s'", getenv("LANG"), mac);
if (!result) {
dbi_conn_error(dbi->conn, &msglog);
syslog(LOG_ERR, "failed to query database (%s:%d) %s\n",
__func__, __LINE__, msglog);
og_dbi_close(dbi);
return -1;
}
if (dbi_result_get_numrows(result) != 1) {
dbi_conn_error(dbi->conn, &msglog);
syslog(LOG_ERR, "failed to query database (%s:%d) %s\n",