---
 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

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to