[systemd-devel] [PATCH] Actually fix capability logging when effective caps are 0
Shawn Landden
shawn at churchofgit.com
Wed Sep 18 13:32:13 PDT 2013
---
src/shared/fileio.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 8aa4cdb..3eaa911 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -673,17 +673,15 @@ int get_status_field(const char *filename, const char *pattern, char **field) {
t += strlen(pattern);
/* Also skip zeros, because when this is used for capabilities,
- * we don't want the zeros. This way the same cabality set
+ * we don't want the zeros. This way the same cabability set
* always maps to the same string, irrespective of the total
* capability set size. For other numbers it shouldn't matter.
*/
- if (*t) {
- t += strspn(t, WHITESPACE "0");
- /* Back off one char if there's nothing but whitespace
- and zeros */
- if (!*t)
- t --;
- }
+ t += strspn(t, WHITESPACE "0");
+ /* Back off to last '0' if there's nothing but whitespace
+ and zeros */
+ if (*(t - 1) == '\n')
+ t -= 2;
len = strcspn(t, WHITESPACE);
--
1.8.4.rc3
More information about the systemd-devel
mailing list