PATCH: Fix strange sql// filename handling

Peter Stamfest <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
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

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
sql.patch (text/x-patch, 473 B)
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.