[rrd-developers] Re: Patch to rrd_dump.c to allow output to a filename as well as stdout

Peter Stamfest peter at stamfest.at
Sun Jan 8 21:15:12 MET 2006


On Sun, 8 Jan 2006, Nicola Worthington wrote:

> Date: Sun, 8 Jan 2006 18:07:36 +0000 (GMT)
> From: Nicola Worthington <nicolaw at arwen.tfb.net>
> To: rrd-developers at list.ee.ethz.ch, oetiker at ee.ethz.ch
> Cc: heds at metahusky.net, nicolaw at cpan.org
> Subject: [rrd-developers] Patch to rrd_dump.c to allow output to a filename as
>      well as stdout
> 
> Dear All,
> Having never submitted a patch before, I was unsure as to where to send it
> to, so I'm taking a best guess at the developers list and Tobi. Please
> correct me if I'm not following protocol. :)
>
> This is a patch to allow rrd_dump to output to a filename if a second
> argument is specified. This makes life a lot easier if you want to use the
> dump functionality in RRDs for example without wanting to do funky stuff
> to capture the output. (Not everyone wants to do output redirection).
>
> The TCL binding has been altered slightly to take this change in to
> account since it was calling the rrd_dump_r method directly instead of
> rrd_dump.
>
> I hope this can be considered for inclusion in the next release. Please
> let me know your thoughts.


+    fprintf(out_file, "</rrd>\n");
      rrd_free(&rrd);
      fclose(in_file);
+    if (out_file)
+    {
+      fclose(out_file);
+    }
      return(0);
  }

Shouldn't that check at least be (out_file != stdout)? Otherwise you'll 
end up closing stdout.

peter

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-developers
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-developers mailing list