summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-22 13:27:29 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-22 13:27:53 +0200
commit3a698817043ca8f4059c52b7ff30097462b1f7bc (patch)
treefc03ae6e2ca0fed886dbc762d9214f2d90de0626
parentfc68c92973e5437ee0489c1bc80d80f0a7b6ca0b (diff)
sd-bus: handle ppid=0 more gracefully (which happens for pid=1)
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 6cb47f55ce..a68b0d00ed 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -768,11 +768,14 @@ int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid) {
if (p) {
p += strspn(p, WHITESPACE);
- r = parse_pid(p, &c->ppid);
- if (r < 0)
- return r;
+ /* Explicitly check for PPID 0 (which is the case for PID 1) */
+ if (!streq(p, "0")) {
+ r = parse_pid(p, &c->ppid);
+ if (r < 0)
+ return r;
- c->mask |= SD_BUS_CREDS_PPID;
+ c->mask |= SD_BUS_CREDS_PPID;
+ }
continue;
}
}