From 02157ab123508341c4019c64017966fbb8ab2921 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 2 Dec 2014 10:41:24 -0600 Subject: [PATCH] libcurl: honor $SSL_CERT_FILE (fixed) The previous attempt to patch libcurl used getenv("CURL_CA_BUNDLE") || getenv("SSL_CERT_FILE") to get the second environment variable if the first is unset. Unfortunately, this broke libcurl because the (||) operator is C returns only 0 or 1, so it is inappropriate for pointer comparisons! Now we use getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE") instead. This has one downside: it always calls getenv twice! But, that's a small price to pay for actually being correct. --- pkgs/tools/networking/curl/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index 2e106c899b9..b54df60ef0a 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE postConfigure = '' - echo '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") || getenv("SSL_CERT_FILE"))' >> lib/curl_config.h + echo '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h ''; configureFlags = [