From: Zbigniew Jędrzejewski-Szmek Date: Wed, 18 Sep 2013 16:39:32 +0000 (-0500) Subject: Fix capability logging when effective caps are 0 X-Git-Tag: v208~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ec29144ddc311d78baa6875631ed6968fd90817;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/fileio.c b/src/shared/fileio.c index 23bc742e75a..8aa4cdbf053 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);