From 93c410f724cb4e8cc63e89f34ef588a109e9b838 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Wed, 30 Oct 2013 22:59:52 +0100 Subject: [PATCH] distroquery: better check for is_update in latest packages --- src/distroquery.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/distroquery.c b/src/distroquery.c index 2ebf519..f137c66 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -855,6 +855,7 @@ void printSpecialQueryResponse() { sqlite3_stmt *statement, *stmt1; struct configTag* ct; int i,a, id, built_for_arch[ARCHS_MAX], built_for_arch_upstream[ARCHS_MAX]; + int is_update; long buildtime; char updates[PATH_MAX]; char warning[PATH_MAX]; @@ -893,6 +894,7 @@ void printSpecialQueryResponse() { if (db && (sqlite3_prepare_v2(db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) { /* loop packages in repository */ while (sqlite3_step(statement) == SQLITE_ROW) { + is_update = 0; i=0; updates[0]=0; warning[0]=0; @@ -906,6 +908,7 @@ void printSpecialQueryResponse() { (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name"))); if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { if (sqlite3_step(stmt1) == SQLITE_ROW) { + is_update = 1; snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)\n", _("Updates"), (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")), ct->repository[i]->tag, @@ -989,11 +992,10 @@ void printSpecialQueryResponse() { (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text"))); } snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n"); -// strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates)); } get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX); - if (updates[0] != 0) { + if (is_update) { printf(" ", ct->configdefaults->url_dir, updates); } else {