From b4350f35f341c1db3004bdb5f07b17f86257d00c Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 14 Mar 2011 08:22:46 +0000 Subject: [PATCH] bring spaceing around graph back in line with 1.2 goodness ... in connection with no-legend and no title git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2179 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_client.c | 6 ++++-- program/src/rrd_graph.c | 9 ++++++--- program/src/rrd_open.c | 2 +- program/src/rrd_update.c | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/program/src/rrd_client.c b/program/src/rrd_client.c index 29d1d299..e3790f6b 100644 --- a/program/src/rrd_client.c +++ b/program/src/rrd_client.c @@ -485,13 +485,14 @@ int rrdc_is_connected(const char *daemon_addr) /* {{{ */ return 0; else if (daemon_addr == NULL) { + char *addr = getenv(ENV_RRDCACHED_ADDRESS); /* here we have to handle the case i.e. * UPDATE --daemon ...; UPDATEV (no --daemon) ... * In other words: we have a cached connection, * 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) + if (addr != NULL && ! strcmp(addr,"")) return 1; else return 0; @@ -655,7 +656,8 @@ int rrdc_connect (const char *addr) /* {{{ */ if (addr == NULL) addr = getenv (ENV_RRDCACHED_ADDRESS); - if (addr == NULL) + if (addr == NULL || ! strcmp(addr,"")) + addr = NULL; return 0; pthread_mutex_lock(&lock); diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index d166f073..fa8f0f41 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -2954,6 +2954,9 @@ int graph_size_location( if (im->second_axis_legend[0] != '\0') { Xvertical2 = im->text_prop[TEXT_PROP_UNIT].size * 2; } + else{ + Xvertical2 = Xspacing; + } if (im->title[0] != '\0') { /* The title is placed "inbetween" two text lines so it @@ -2965,7 +2968,7 @@ int graph_size_location( } else{ // we have no title; get a little clearing from the top - Ytitle = 1.5 * Yspacing; + Ytitle = Yspacing; } if (elements) { @@ -3059,7 +3062,7 @@ int graph_size_location( /* reserve space for padding below the graph */ if (im->extra_flags & NOLEGEND) { - Ymain -= Yspacing; + Ymain -= 0.5*Yspacing; } if (im->watermark[0] != '\0') { @@ -3119,7 +3122,7 @@ int graph_size_location( } /* reserve space for padding below the graph */ if (im->extra_flags & NOLEGEND) { - im->yimg += Yspacing; + im->yimg += 0.5*Yspacing; } if (im->watermark[0] != '\0') { diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c index 5f3723f3..7c508ff2 100644 --- a/program/src/rrd_open.c +++ b/program/src/rrd_open.c @@ -671,7 +671,7 @@ ssize_t rrd_write( if((rrd_file->pos + count) > old_size) { - rrd_set_error("attempting to write beyond end of file"); + rrd_set_error("attempting to write beyond end of file (%ld + %ld > %ld)",rrd_file->pos, count, old_size); return -1; } memcpy(rrd_simple_file->file_start + rrd_file->pos, buf, count); diff --git a/program/src/rrd_update.c b/program/src/rrd_update.c index dbf74df6..c5917c0b 100644 --- a/program/src/rrd_update.c +++ b/program/src/rrd_update.c @@ -352,14 +352,14 @@ rrd_info_t *rrd_update_v( } opt_daemon = getenv (ENV_RRDCACHED_ADDRESS); - if (opt_daemon != NULL) { + if (opt_daemon != NULL && ! strcmp(opt_daemon,"")) { rrd_set_error ("The \"%s\" environment variable is defined, " "but \"%s\" cannot work with rrdcached. Either unset " "the environment variable or use \"update\" instead.", ENV_RRDCACHED_ADDRESS, argv[0]); goto end_tag; } - + /* need at least 2 arguments: filename, data. */ if (argc - optind < 2) { rrd_set_error("Not enough arguments"); -- 2.30.2