diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-18 18:39:32 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-18 18:43:29 +0200 |
commit | 4ec29144ddc311d78baa6875631ed6968fd90817 (patch) | |
tree | dc2a63feed64e76513a3abff87dce4ea2ba8a751 | |
parent | polkit: Avoid race condition in scraping /proc (diff) | |
download | systemd-4ec29144ddc311d78baa6875631ed6968fd90817.tar.xz systemd-4ec29144ddc311d78baa6875631ed6968fd90817.zip |
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.
-rw-r--r-- | src/shared/fileio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c index 23bc742e75..8aa4cdbf05 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); |