From: oetiker Date: Thu, 24 Nov 2011 10:55:18 +0000 (+0000) Subject: properly handle the case where RRDCACHED_ADDRESS is an empty string X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cb0025e7bb3439880f934489243d1a35cdaffe73;p=rrdtool.git properly handle the case where RRDCACHED_ADDRESS is an empty string git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2220 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_client.c b/src/rrd_client.c index 11c1e33..e7c227b 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -350,7 +350,8 @@ int rrdc_is_connected(const char *daemon_addr) /* {{{ */ * but it is not specified in the current command. * Daemon is only implied in this case if set in ENV */ - if (getenv(ENV_RRDCACHED_ADDRESS) != NULL) + char *addr = getenv(ENV_RRDCACHED_ADDRESS); + if (addr != NULL && strcmp(addr,"") != 0) return 1; else return 0; @@ -515,7 +516,7 @@ int rrdc_connect (const char *addr) /* {{{ */ addr = getenv (ENV_RRDCACHED_ADDRESS); } - if (addr == NULL || ! strcmp(addr,"") ) { + if (addr == NULL || strcmp(addr,"") == 0 ) { addr = NULL; return 0; }