[systemd-devel] [PATCH] Actually fix capability logging when effective caps are 0
Shawn Landden
shawn at churchofgit.com
Wed Sep 18 11:34:51 PDT 2013
---
src/shared/fileio.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 8aa4cdb..3a7f84e 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -677,13 +677,11 @@ 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.
*/
- 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