#include "time-util.h"
#include "strv.h"
#include "bus-creds.h"
+#include "bus-label.h"
enum {
CAP_OFFSET_INHERITABLE = 0,
return c;
}
-_public_ int sd_bus_creds_new_from_pid(pid_t pid, uint64_t mask, sd_bus_creds **ret) {
+_public_ int sd_bus_creds_new_from_pid(sd_bus_creds **ret, pid_t pid, uint64_t mask) {
sd_bus_creds *c;
int r;
/* Check if the process existed at all, in case we haven't
* figured that out already */
- if (kill(pid, 0) < 0 && errno == ESRCH) {
+ if (!pid_is_alive(pid)) {
sd_bus_creds_unref(c);
return -ESRCH;
}
assert(c->conn_name);
if (!c->unescaped_conn_name) {
- c->unescaped_conn_name = sd_bus_label_unescape(c->conn_name);
+ c->unescaped_conn_name = bus_label_unescape(c->conn_name);
if (!c->unescaped_conn_name)
return -ENOMEM;
}
if (tid > 0 && (missing & SD_BUS_CREDS_TID_COMM)) {
_cleanup_free_ char *p = NULL;
- if (asprintf(&p, "/proc/%lu/task/%lu/comm", (unsigned long) pid, (unsigned long) tid) < 0)
+ if (asprintf(&p, "/proc/"PID_FMT"/task/"PID_FMT"/comm", pid, tid) < 0)
return -ENOMEM;
r = read_one_line_file(p, &c->tid_comm);