Fix capability logging when effective caps are 0

Shawn Landen> Doesn't this also skip the last '0' when it is all '0's?
              You need to keep the last one.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-09-18 11:39:32 -05:00
parent 72fd713962
commit 4ec29144dd

View file

@ -677,7 +677,13 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
* always maps to the same string, irrespective of the total
* capability set size. For other numbers it shouldn't matter.
*/
t += strspn(t, WHITESPACE "0");
if (*t) {
t += strspn(t, WHITESPACE "0");
/* Back off one char if there's nothing but whitespace
and zeros */
if (!*t)
t --;
}
len = strcspn(t, WHITESPACE);