diff options
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client.c b/src/client.c index d5e0391..675be74 100644 --- a/src/client.c +++ b/src/client.c @@ -621,15 +621,15 @@ static bool og_dbi_update_image(struct og_dbi *dbi, const struct og_image_legacy *img_info, const char *computer_id) { + int repo_id, sw_id, repo_alias; const char *msglog; dbi_result result; - int repo_id, sw_id; uint32_t revision; /* find repository identifier by repository ip and computer ID. */ result = dbi_conn_queryf(dbi->conn, - "SELECT repositorios.idrepositorio" - " FROM repositorios" + "SELECT repositorios.idrepositorio, repositorios.alias" + " FROM repositorios" " LEFT JOIN ordenadores USING (idrepositorio)" " WHERE repositorios.ip='%s' AND ordenadores.idordenador=%s", img_info->repo, computer_id); @@ -646,7 +646,12 @@ static bool og_dbi_update_image(struct og_dbi *dbi, dbi_result_free(result); return false; } - repo_id = dbi_result_get_uint(result, "idrepositorio"); + repo_alias = dbi_result_get_uint(result, "alias"); + if (repo_alias) + repo_id = repo_alias; + else + repo_id = dbi_result_get_uint(result, "idrepositorio"); + dbi_result_free(result); /* find software id by computer ID, disk number and partition. */ |