---
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
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel