Re: PATCH: Fix strange sql// filename handling

Tobias Oetiker <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <[email protected]>
Hi Peter,

thanks for the patch ... integrated

cheers
tobi
Yesterday Peter Stamfest wrote:

>
> 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
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900
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.