From: Sebastian Harl Date: Tue, 22 Jan 2008 08:34:03 +0000 (+0100) Subject: apache plugin: Do not initialize the plugin if no URL has been specified. X-Git-Tag: collectd-4.3.0beta0~10^2~1^2~1^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40cbdef8475076515d30be35dfc54c70896eafab;p=collectd.git apache plugin: Do not initialize the plugin if no URL has been specified. There is no need to initialize curl, if the plugin will not be used anyway. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/apache.c b/src/apache.c index 2365d1ff..5a3272f8 100644 --- a/src/apache.c +++ b/src/apache.c @@ -102,6 +102,9 @@ static int init (void) { static char credentials[1024]; + if (url == NULL) + return (0); + if (curl != NULL) { curl_easy_cleanup (curl); @@ -128,10 +131,7 @@ static int init (void) curl_easy_setopt (curl, CURLOPT_USERPWD, credentials); } - if (url != NULL) - { - curl_easy_setopt (curl, CURLOPT_URL, url); - } + curl_easy_setopt (curl, CURLOPT_URL, url); if (cacert != NULL) {