summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r--src/shared/bus-util.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index a4e0ec105..eb953b9bb 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -563,8 +563,7 @@ void bus_verify_polkit_async_registry_free(Hashmap *registry) {
#if 0 /// UNNEEDED by elogind
int bus_check_peercred(sd_bus *c) {
struct ucred ucred;
- socklen_t l;
- int fd;
+ int fd, r;
assert(c);
@@ -572,12 +571,9 @@ int bus_check_peercred(sd_bus *c) {
if (fd < 0)
return fd;
- l = sizeof(struct ucred);
- if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &l) < 0)
- return -errno;
-
- if (l != sizeof(struct ucred))
- return -E2BIG;
+ r = getpeercred(fd, &ucred);
+ if (r < 0)
+ return r;
if (ucred.uid != 0 && ucred.uid != geteuid())
return -EPERM;