From cb0025e7bb3439880f934489243d1a35cdaffe73 Mon Sep 17 00:00:00 2001 From: oetiker Date: Thu, 24 Nov 2011 10:55:18 +0000 Subject: [PATCH] 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 --- src/rrd_client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; } -- 2.30.2