chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72fd713
)
Fix capability logging when effective caps are 0
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 18 Sep 2013 16:39:32 +0000
(11:39 -0500)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Wed, 18 Sep 2013 16:43:29 +0000
(11:43 -0500)
Shawn Landen> Doesn't this also skip the last '0' when it is all '0's?
You need to keep the last one.
src/shared/fileio.c
patch
|
blob
|
history
diff --git
a/src/shared/fileio.c
b/src/shared/fileio.c
index 23bc742e75ad71c0674d3345cf580aa0fb693331..8aa4cdbf053c18f02bc4c7b964cf81ae355c0fa0 100644
(file)
--- 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);