summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-18 11:39:32 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-18 11:43:29 -0500
commit4ec29144ddc311d78baa6875631ed6968fd90817 (patch)
treedc2a63feed64e76513a3abff87dce4ea2ba8a751
parent72fd713962ca2c2450e23b01d9e22017a7e28fd4 (diff)
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.
-rw-r--r--src/shared/fileio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 23bc742e75..8aa4cdbf05 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -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);