sd-bus: handle ppid=0 more gracefully (which happens for pid=1)

This commit is contained in:
Lennart Poettering 2015-04-22 13:27:29 +02:00
parent fc68c92973
commit 3a69881704
1 changed files with 7 additions and 4 deletions

View File

@ -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;
}
}