[rrd-developers] [PATCH] rrdc_flush_if_daemon should not clobber error message

Tobias Oetiker tobi at oetiker.ch
Fri Oct 17 07:50:42 CEST 2008


Today kevin brintnall wrote:

> Tobi,
>
> I didn't notice that you'd already applied my earlier patch into /trunk.
> This one should apply cleanly on top.
>
> Thanks.
>
> -----------------------------------------------------------------
>
> failure in rrdc_flush_if_daemon  will rrd_set_error() if necessary
>
> Suggestion from Sebastian Harl.  If the client already set an error
> message, it is preserved.  Otherwise, add a message corresponding to the
> return code from rrdc_flush.

it's in
tobi


>
> ---
> diff --git a/src/rrd_client.c b/src/rrd_client.c
> index 5e22a98..8e60664 100644
> --- a/src/rrd_client.c
> +++ b/src/rrd_client.c
> @@ -615,8 +615,25 @@ int rrdc_flush_if_daemon (const char *opt_daemon, const char *filename) /* {{{ *
>    rrdc_connect(opt_daemon);
>
>    if (rrdc_is_connected(opt_daemon))
> +  {
> +    rrd_clear_error();
>      status = rrdc_flush (filename);
>
> +    if (status != 0 && !rrd_test_error())
> +    {
> +      if (status > 0)
> +      {
> +        rrd_set_error("rrdc_flush (%s) failed: %s",
> +                      filename, rrd_strerror(status));
> +      }
> +      else 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 */
>
>
> _______________________________________________
> rrd-developers mailing list
> rrd-developers at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list