aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-02-02 15:11:22 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-02-03 22:56:58 +0000
commit6127e54f4083af016e229568502de6e578aa973e (patch)
tree442f95dbe95592f9642457b439b314ae17cd7628
parent8b6654224ba5f7ab358f4ebdb8270c3d92fd61df (diff)
tool_operate: Moved libcurl information gathering to tool_main
-rw-r--r--src/tool_main.c26
-rw-r--r--src/tool_operate.c6
2 files changed, 19 insertions, 13 deletions
diff --git a/src/tool_main.c b/src/tool_main.c
index ba9b518e1..a46877b3e 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -38,6 +38,7 @@
#include "tool_panykey.h"
#include "tool_vms.h"
#include "tool_main.h"
+#include "tool_libinfo.h"
/*
* This is low-level hard-hacking memory leak tracking and similar. Using
@@ -120,14 +121,28 @@ static void memory_tracking_init(void)
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result.
*/
-static CURLcode main_init(void)
+static CURLcode main_init(struct Configurable *config)
{
+ CURLcode result = CURLE_OK;
+
#if defined(__DJGPP__) || defined(__GO32__)
/* stop stat() wasting time */
_djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
#endif
- return curl_global_init(CURL_GLOBAL_DEFAULT);
+ /* Perform the libcurl initialization */
+ result = curl_global_init(CURL_GLOBAL_DEFAULT);
+ if(!result) {
+ /* Get information about libcurl */
+ result = get_libcurl_info();
+
+ if(result)
+ helpf(config->errors, "error retrieving curl library information\n");
+ }
+ else
+ helpf(config->errors, "error initializing curl library\n");
+
+ return result;
}
/*
@@ -167,17 +182,14 @@ int main(int argc, char *argv[])
/* Initialize the curl library - do not call any libcurl functions before
this point */
- if(!main_init()) {
+ res = main_init(config);
+ if(!res) {
/* Start our curl operation */
res = operate(config, argc, argv);
/* Perform the main cleanup */
main_free();
}
- else {
- helpf(config->errors, "error initializing curl library\n");
- res = CURLE_FAILED_INIT;
- }
#ifdef __SYMBIAN32__
if(config->showerror)
diff --git a/src/tool_operate.c b/src/tool_operate.c
index af9e1de02..5cdecd9b3 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -212,12 +212,6 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
heads.stream = stdout;
heads.config = config;
- /* Get libcurl info right away */
- if(get_libcurl_info() != CURLE_OK) {
- helpf(config->errors, "error retrieving curl library information\n");
- return CURLE_FAILED_INIT;
- }
-
/* Get a curl handle to use for all forthcoming curl transfers */
curl = curl_easy_init();
if(!curl) {