diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-15 10:09:02 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-07-15 14:25:22 +0200 |
commit | d6284b613835ddd1b250688cb7fe657119490820 (patch) | |
tree | dd584d9ebd732347dee389eed888596f2e474bbb /src | |
parent | 3bfdf6b4778d9b2814c51f121ac3d53eec22c9e1 (diff) |
rest: add dbi query checks in og_set_client_mode
Check if the the execution of the main SQL query is not
successfull.
Diffstat (limited to 'src')
-rw-r--r-- | src/rest.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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", |