[collectd] Re: collectd-3.7.1 compile error, digest <et.al.>

Florian Forster octo at verplant.org
Sun Feb 19 10:44:02 CET 2006


Hi Sebastian,

are you really sure the battery plugin works on your laptop? I've found
this immensely dumb bug (multiplied apparently by copy'n'paste) that
should lead to totally crippled values..
Of course this patch will go into the 3.7.2 due today ;) Though I'd
prefer if we could sort out this ACPI problem..

Werner, please try the `battery.c' from the subversion repository
(revision 480 or later).

Regards,
-octo

On Sun, Feb 19, 2006 at 10:34:00AM +0100, subversion.verplant.org wrote:
> Author: octo
> Date: 2006-02-19 10:33:58 +0100 (Sun, 19 Feb 2006)
> New Revision: 479
> 
> Modified:
>    trunk/src/battery.c
> Log:
> Fixed the comparsion using `strcmp'
> 
> 
> Modified: trunk/src/battery.c
> ===================================================================
> --- trunk/src/battery.c	2006-02-18 11:56:17 UTC (rev 478)
> +++ trunk/src/battery.c	2006-02-19 09:33:58 UTC (rev 479)
> @@ -285,20 +285,20 @@
>  				if (numfields < 3)
>  					continue;
>  
> -				if ((strcmp (fields[0], "present"))
> -						&& (strcmp (fields[1], "rate:")))
> +				if ((strcmp (fields[0], "present") == 0)
> +						&& (strcmp (fields[1], "rate:") == 0))
>  					valptr = &current;
> -				else if ((strcmp (fields[0], "remaining"))
> -						&& (strcmp (fields[1], "capacity:")))
> +				else if ((strcmp (fields[0], "remaining") == 0)
> +						&& (strcmp (fields[1], "capacity:") == 0))
>  					valptr = &charge;
> -				else if ((strcmp (fields[0], "present"))
> -						&& (strcmp (fields[1], "voltage:")))
> +				else if ((strcmp (fields[0], "present") == 0)
> +						&& (strcmp (fields[1], "voltage:") == 0))
>  					valptr = &voltage;
>  				else
>  					valptr = NULL;
>  
> -				if ((strcmp (fields[0], "charging"))
> -						&& (strcmp (fields[1], "state:")))
> +				if ((strcmp (fields[0], "charging") == 0)
> +						&& (strcmp (fields[1], "state:") == 0))
>  				{
>  					if (strcmp (fields[2], "charging"))
>  						charging = 1;
> 


-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20060219/56f5fe8d/attachment.pgp


More information about the Collectd mailing list