From: oetiker Date: Mon, 14 Mar 2011 08:22:46 +0000 (+0000) Subject: bring spaceing around graph back in line with 1.2 goodness ... in connection with... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=13d7a72e157462f61aa90d3352479c0b4180e069;p=rrdtool.git 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/program@2179 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_client.c b/src/rrd_client.c index 29d1d29..e3790f6 100644 --- a/src/rrd_client.c +++ b/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/src/rrd_graph.c b/src/rrd_graph.c index d166f07..fa8f0f4 100644 --- a/src/rrd_graph.c +++ b/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/src/rrd_open.c b/src/rrd_open.c index 5f3723f..7c508ff 100644 --- a/src/rrd_open.c +++ b/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/src/rrd_update.c b/src/rrd_update.c index dbf74df..c5917c0 100644 --- a/src/rrd_update.c +++ b/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");