From: ticktock35 Date: Mon, 15 Dec 2008 04:20:20 +0000 (+0000) Subject: opkg: improve download error reporting X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0a94bb14c9cfed746d645a35872fc9daa308ab5d;p=oweals%2Fopkg-lede.git opkg: improve download error reporting git-svn-id: http://opkg.googlecode.com/svn/trunk@22 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/opkg_cmd.c b/opkg_cmd.c index 20d3872..db04a4a 100644 --- a/opkg_cmd.c +++ b/opkg_cmd.c @@ -287,6 +287,7 @@ static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv) err = opkg_download(conf, url, tmp_file_name); if (err) { failures++; + opkg_message (conf, OPKG_NOTICE, "Signature check failed\n"); } else { int err; err = opkg_verify_file (list_file_name, tmp_file_name); @@ -296,6 +297,7 @@ static int opkg_update_cmd(opkg_conf_t *conf, int argc, char **argv) opkg_message (conf, OPKG_NOTICE, "Signature check failed\n"); } unlink (tmp_file_name); + unlink (tmp); free (tmp_file_name); free (url); diff --git a/opkg_download.c b/opkg_download.c index 6370250..161a510 100644 --- a/opkg_download.c +++ b/opkg_download.c @@ -60,6 +60,12 @@ curl_progress_func (char* url, } #endif + /* skip progress bar if we haven't done started yet + * this prevents drawing the progress bar if we receive an error such as + * file not found */ + if (t == 0) + return 0; + printf ("\r%3d%% |", p); for (i = 1; i < 73; i++) { @@ -166,7 +172,12 @@ int opkg_download(opkg_conf_t *conf, const char *src, const char *dest_file_name curl_easy_cleanup (curl); fclose (file); if (res) + { + long error_code; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &error_code); + opkg_message(conf, OPKG_ERROR, "Failed to download %s, error %d\n", src, error_code); return res; + } } else