[rrd-developers] PATCH: Fix strange sql// filename handling

Peter Stamfest peter at stamfest.at
Wed Mar 2 21:07:16 CET 2011


Hi!

This fixes some strange file name handling wrt libdbi.

The original code would identify a file named "sqlxxabc.rrd" as a libdbi 
specification, if I read the code right.

I found this when browsing the source code, so both the bug and the fix 
are untested.

Patch is both inlined and attached:



Index: src/rrd_fetch.c
===================================================================
--- src/rrd_fetch.c    (revision 2175)
+++ src/rrd_fetch.c    (working copy)
@@ -240,10 +240,8 @@

  #ifdef HAVE_LIBDBI
      /* handle libdbi datasources */
-    if (strncmp("sql",filename,3)==0) {
-      if (filename[3]==filename[4]) {
+    if (strncmp("sql//",filename,5)==0) {
      return 
rrd_fetch_fn_libdbi(filename,cf_idx,start,end,step,ds_cnt,ds_namv,data);
-      }
      }
  #endif





peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sql.patch
Type: text/x-patch
Size: 473 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20110302/7bd8df50/attachment.bin 


More information about the rrd-developers mailing list