Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
curl_init: return -1 to indicate failure
Browse files Browse the repository at this point in the history
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
  • Loading branch information
yanhan committed May 26, 2011
1 parent 8c30d00 commit 455b0bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion curl.c
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion curl.h
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions powaur.c
Expand Up @@ -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();
Expand Down Expand Up @@ -57,7 +56,10 @@ static int powaur_init(void)
}
}

curl_init();
if (curl_init()) {
return error(PW_ERR_CURL_INIT);
}

return ret;
}

Expand Down

0 comments on commit 455b0bd

Please sign in to comment.