All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Reiter <ockham@raz.or.at>
To: git@vger.kernel.org
Subject: [PATCH] http.c: die if curl_*_init fails
Date: Wed, 13 Aug 2014 19:31:24 +0200	[thread overview]
Message-ID: <53EBA0EC.9000007@raz.or.at> (raw)

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]


Signed-off-by: Bernhard Reiter <ockham@raz.or.at>
---
 http.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



[-- Attachment #2: 0002-http.c-die-if-curl_-_init-fails.patch --]
[-- Type: text/x-patch, Size: 705 bytes --]

diff --git a/http.c b/http.c
index c8cd50d..afe4fc5 100644
--- a/http.c
+++ b/http.c
@@ -300,6 +300,9 @@ static CURL *get_curl_handle(void)
 {
 	CURL *result = curl_easy_init();
 
+	if (!result)
+		die("curl_easy_init failed");
+
 	if (!curl_ssl_verify) {
 		curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
 		curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
@@ -399,7 +402,8 @@ void http_init(struct remote *remote, const char *url, int proactive_auth)
 	git_config(urlmatch_config_entry, &config);
 	free(normalized_url);
 
-	curl_global_init(CURL_GLOBAL_ALL);
+	if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
+		die("curl_global_init failed");
 
 	http_proactive_auth = proactive_auth;
 


             reply	other threads:[~2014-08-13 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 17:31 Bernhard Reiter [this message]
2014-08-17  7:35 ` [PATCH] http.c: die if curl_*_init fails Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53EBA0EC.9000007@raz.or.at \
    --to=ockham@raz.or.at \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.