6f86f68387
Update to powertop 1.98 (forwarded request 102454 from a_jaeger) OBS-URL: https://build.opensuse.org/request/show/102498 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/powertop?expand=0&rev=23
36 lines
978 B
Diff
36 lines
978 B
Diff
diff -up powertop-1.98/measurement/acpi.cpp.orig powertop-1.98/measurement/acpi.cpp
|
|
--- powertop-1.98/measurement/acpi.cpp.orig 2011-05-11 06:48:37.000000000 +0200
|
|
+++ powertop-1.98/measurement/acpi.cpp 2012-01-10 18:31:21.093799991 +0100
|
|
@@ -108,8 +108,13 @@ void acpi_power_meter::measure(void)
|
|
while (*c == ' ') c++;
|
|
_capacity = strtoull(c, NULL, 10);
|
|
c = strchr(c, ' ');
|
|
- c++;
|
|
- strcpy(capacity_units, c);
|
|
+ if (c) {
|
|
+ c++;
|
|
+ strcpy(capacity_units, c);
|
|
+ } else {
|
|
+ _capacity = 0;
|
|
+ strcpy(capacity_units, "Unknown");
|
|
+ }
|
|
}
|
|
if (strstr(line, "present voltage:")) {
|
|
c = strchr(line, ':');
|
|
@@ -117,8 +122,13 @@ void acpi_power_meter::measure(void)
|
|
while (*c == ' ') c++;
|
|
_voltage = strtoull(c, NULL, 10);
|
|
c = strchr(c, ' ');
|
|
- c++;
|
|
- strcpy(voltage_units, c);
|
|
+ if (c) {
|
|
+ c++;
|
|
+ strcpy(voltage_units, c);
|
|
+ } else {
|
|
+ _voltage = 0;
|
|
+ strcpy(voltage_units, "Unknown");
|
|
+ }
|
|
}
|
|
}
|
|
file.close();
|