Permalink
Browse files

curl_init: return -1 to indicate failure

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
  • Loading branch information...
1 parent 8c30d00 commit 455b0bddcafa00e8dcd10c1da329c6cada255fb3 @yanhan committed May 26, 2011
Showing with 8 additions and 4 deletions.
  1. +3 −1 curl.c
  2. +1 −1 curl.h
  3. +4 −2 powaur.c
View
4 curl.c
@@ -5,12 +5,14 @@
static int initialized = 0;
-void curl_init(void)
+int curl_init(void)
{
if (!initialized) {
curl_global_init(CURL_GLOBAL_ALL);
initialized = 1;
}
+
+ return !initialized;
}
void curl_cleanup(void)
View
2 curl.h
@@ -3,7 +3,7 @@
#include <curl/curl.h>
-void curl_init(void);
+int curl_init(void);
void curl_cleanup(void);
CURL *curl_easy_new(void);
void curl_reset(CURL *curl);
View
@@ -24,7 +24,6 @@ static alpm_list_t *powaur_targets = NULL;
static int powaur_cleanup(int ret)
{
FREELIST(powaur_targets);
-
curl_cleanup();
_pwhandle_free(pwhandle);
cleanup_environment();
@@ -57,7 +56,10 @@ static int powaur_init(void)
}
}
- curl_init();
+ if (curl_init()) {
+ return error(PW_ERR_CURL_INIT);
+ }
+
return ret;
}

0 comments on commit 455b0bd

Please sign in to comment.