1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00

Fix unknown short battery status

Before, in the case of an unknown battery status (which often happens on my Sony VAIO laptop after waking from sleep), the buffer would be unterminated.

(Although, this memmove trick is a bit odd. It would probably be better to remove the memmove's and put a single buffer[1] = '\0'; at the end of the function).
This commit is contained in:
Brian Mattern 2013-04-30 10:33:42 -07:00
parent f0d0a03b8e
commit b08410dab4

View File

@ -2088,7 +2088,7 @@ void get_battery_short_status(char *buffer, unsigned int n, const char *bat)
memmove(buffer + 1, buffer + 5, n - 5); memmove(buffer + 1, buffer + 5, n - 5);
} else if (0 != strncmp("AC", buffer, 2)) { } else if (0 != strncmp("AC", buffer, 2)) {
buffer[0] = 'U'; buffer[0] = 'U';
memmove(buffer + 1, buffer + 11, n - 11); memmove(buffer + 1, buffer + 2, n - 2);
} }
} }