X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_client.c;h=5e22a988b20daab34c42ec1fd3da75fa82454773;hb=6c6bd6077fbc7dd9caa23e73e41b62af346e1fbf;hp=76fded03830fee7346f9ee98258bff027661b29d;hpb=24a1cb649dd3b5c5d93fa470ebfe4d88abb2af00;p=rrdtool.git diff --git a/src/rrd_client.c b/src/rrd_client.c index 76fded0..5e22a98 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -518,6 +518,7 @@ int rrdc_update (const char *filename, int values_num, /* {{{ */ rrdc_response_t *res; int status; int i; + char file_path[PATH_MAX]; memset (buffer, 0, sizeof (buffer)); buffer_ptr = &buffer[0]; @@ -527,6 +528,10 @@ int rrdc_update (const char *filename, int values_num, /* {{{ */ if (status != 0) return (ENOBUFS); + /* change to absolute path for rrdcached */ + if (*filename != '/' && realpath(filename, file_path) != NULL) + filename = file_path; + status = buffer_add_string (filename, &buffer_ptr, &buffer_free); if (status != 0) return (ENOBUFS); @@ -562,6 +567,7 @@ int rrdc_flush (const char *filename) /* {{{ */ size_t buffer_size; rrdc_response_t *res; int status; + char file_path[PATH_MAX]; if (filename == NULL) return (-1); @@ -574,6 +580,10 @@ int rrdc_flush (const char *filename) /* {{{ */ if (status != 0) return (ENOBUFS); + /* change to absolute path for rrdcached */ + if (*filename != '/' && realpath(filename, file_path) != NULL) + filename = file_path; + status = buffer_add_string (filename, &buffer_ptr, &buffer_free); if (status != 0) return (ENOBUFS); @@ -605,14 +615,7 @@ int rrdc_flush_if_daemon (const char *opt_daemon, const char *filename) /* {{{ * rrdc_connect(opt_daemon); if (rrdc_is_connected(opt_daemon)) - { status = rrdc_flush (filename); - if (status != 0) - { - rrd_set_error ("rrdc_flush (%s) failed with status %i.", - filename, status); - } - } /* if (rrdc_is_connected(..)) */ return status; } /* }}} int rrdc_flush_if_daemon */