summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-21 20:52:44 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-21 20:52:44 (EST)
commit1482f86dcc9188ddc70644195e0f3ec230157f13 (patch)
treefe3580f1ddc39a25f691cefa19abc176639e661e
parent5d24a0917e15506f9e9f53a2e19aa431bb90e660 (diff)
Return negative error code from opkg_download(), not curl error codes.
git-svn-id: http://opkg.googlecode.com/svn/trunk@509 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/opkg.c21
-rw-r--r--libopkg/opkg_download.c4
2 files changed, 7 insertions, 18 deletions
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index 38a536e..fdb2fe3 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -816,11 +816,8 @@ opkg_find_package(const char *name, const char *ver, const char *arch,
return pkg;
}
-#ifdef HAVE_CURL
-#include <curl/curl.h>
-#endif
/**
- * @brief Check the accessibility of repositories. It will try to access the repository to check if the respository is accessible throught current network status.
+ * @brief Check the accessibility of repositories.
* @return return how many repositories cannot access. 0 means all okay.
*/
int
@@ -831,7 +828,6 @@ opkg_repository_accessibility_check(void)
str_list_t *src;
int repositories = 0;
int ret = 0;
- int err;
char *repo_ptr;
char *stmp;
char *host, *end;
@@ -862,24 +858,17 @@ opkg_repository_accessibility_check(void)
free(repo_ptr);
repositories++;
}
+
while (repositories > 0) {
iter1 = str_list_pop(src);
repositories--;
- err = opkg_download(iter1->data, "/dev/null", NULL, NULL);
-#ifdef HAVE_CURL
- if (!(err == CURLE_OK ||
- err == CURLE_HTTP_RETURNED_ERROR ||
- err == CURLE_FILE_COULDNT_READ_FILE ||
- err == CURLE_REMOTE_FILE_NOT_FOUND ||
- err == CURLE_TFTP_NOTFOUND)) {
-#else
- if (!(err == 0)) {
-#endif
+ if (opkg_download(iter1->data, "/dev/null", NULL, NULL))
ret++;
- }
str_list_elt_deinit(iter1);
}
+
free(src);
+
return ret;
}
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index 080326c..cfbf351 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -144,7 +144,7 @@ opkg_download(const char *src, const char *dest_file_name,
opkg_msg(ERROR, "Failed to download %s: %s.\n",
src, curl_easy_strerror(res));
free(tmp_file_location);
- return res;
+ return -1;
}
}
@@ -174,7 +174,7 @@ opkg_download(const char *src, const char *dest_file_name,
if (res) {
opkg_msg(ERROR, "Failed to download %s, wget returned %d.\n", src, res);
free(tmp_file_location);
- return res;
+ return -1;
}
}
#endif