Ad Widget

Collapse

PATCH [1.3.7]: Performance Counter probelm with []

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NOB
    Senior Member
    Zabbix Certified Specialist
    • Mar 2007
    • 469

    #1

    PATCH [1.3.7]: Performance Counter probelm with []

    Hi,

    my suggested fix for the performance counter problem on Windows
    if they contain the character ']':

    I think it should work for all platforms.

    Code:
    --- sysinfo.c.orig      Thu May 10 12:10:28 2007
    +++ sysinfo.c   Fri May 11 13:49:43 2007
    @@ -258,8 +258,8 @@
            if(param)
                    zbx_strlcpy(param, "", param_max_len);
     
    -       pl = strstr(localstr, "[");
    -       pr = strstr(localstr, "]");
    +       pl = strchr(localstr, '[');
    +       pr = strrchr(localstr, ']');
     
            if(pl > pr)
                    return 0;
    strchr is faster than strstr, I guess and what we need is to get the position
    of the last ']', not the first ']'.

    Regards,

    Norbert.
    Last edited by NOB; 11-05-2007, 14:09.
Working...