X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_dump.c;h=3f79a96ff7340463c58242cc02d3032d63d34f0a;hb=0a5d814368107f20baa26ddba418ceab9d47f901;hp=552c636c472e799601ac6657321302019605c367;hpb=ac630adec930653637199258efd99024d49325c7;p=rrdtool.git diff --git a/src/rrd_dump.c b/src/rrd_dump.c index 552c636..3f79a96 100644 --- a/src/rrd_dump.c +++ b/src/rrd_dump.c @@ -49,8 +49,7 @@ extern char *tzname[2]; #endif - -int rrd_dump_opt_r( +static int rrd_dump_opt_r( const char *filename, char *outname, int opt_noheader) @@ -493,43 +492,9 @@ int rrd_dump( return (-1); } - if (opt_daemon == NULL) - { - char *temp; - - temp = getenv (ENV_RRDCACHED_ADDRESS); - if (temp != NULL) - { - opt_daemon = strdup (temp); - if (opt_daemon == NULL) - { - rrd_set_error("strdup failed."); - return (-1); - } - } - } - - if (opt_daemon != NULL) - { - int status; - - status = rrdc_connect (opt_daemon); - if (status != 0) - { - rrd_set_error ("rrdc_connect failed with status %i.", status); - return (-1); - } - - status = rrdc_flush (argv[optind]); - if (status != 0) - { - rrd_set_error ("rrdc_flush (%s) failed with status %i.", - argv[optind], status); - return (-1); - } - - rrdc_disconnect (); - } /* if (opt_daemon) */ + rc = rrdc_flush_if_daemon(opt_daemon, argv[optind]); + if (opt_daemon) free(opt_daemon); + if (rc) return (rc); if ((argc - optind) == 2) { rc = rrd_dump_opt_r(argv[optind], argv[optind + 1], opt_noheader);