X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_client.c;h=f271f3db56f25f5906ea1ad11d40e7e879cb47ec;hb=23a7a9744b3f840f358e1c8e8483f93bd2bdf97f;hp=e3790f6b24e2ab8177337cd00a998f16fd5708e2;hpb=13d7a72e157462f61aa90d3352479c0b4180e069;p=rrdtool.git diff --git a/src/rrd_client.c b/src/rrd_client.c index e3790f6..f271f3d 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -492,7 +492,7 @@ 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 (addr != NULL && ! strcmp(addr,"")) + if (addr != NULL && strcmp(addr,"") != 0) return 1; else return 0; @@ -653,12 +653,14 @@ int rrdc_connect (const char *addr) /* {{{ */ { int status = 0; - if (addr == NULL) + if (addr == NULL) { addr = getenv (ENV_RRDCACHED_ADDRESS); + } - if (addr == NULL || ! strcmp(addr,"")) + if (addr == NULL || strcmp(addr,"") == 0) { addr = NULL; return 0; + } pthread_mutex_lock(&lock); @@ -911,8 +913,7 @@ rrd_info_t * rrdc_info (const char *filename) /* {{{ */ break; case RD_I_STR: chomp(s); - info.u_str = (char*)malloc(sizeof(char) * (strlen(s) + 1)); - strcpy(info.u_str,s); + info.u_str = strdup(s); break; case RD_I_BLO: rrd_set_error ("rrdc_info: BLOB objects are not supported"); @@ -1493,7 +1494,11 @@ int rrdc_stats_get (rrdc_stats_t **ret_stats) /* {{{ */ response_free (res); if (head == NULL) +#ifdef EPROTO return (EPROTO); +#else + return (EINVAL); +#endif *ret_stats = head; return (0);