From c599b325b6b7c797a5f4adf7637eaff4c4695786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 4 Jan 2018 15:28:57 +0100 Subject: [PATCH] bus-socket: slight simplification in bus_get_peercred() --- src/libsystemd/sd-bus/bus-socket.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index 61539313bce..4eaecffa856 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -620,13 +620,10 @@ static void bus_get_peercred(sd_bus *b) { /* Get the list of auxiliary groups of the peer */ r = getpeergroups(b->input_fd, &b->groups); - if (r < 0) { - if (!IN_SET(r, -EOPNOTSUPP, -ENOPROTOOPT)) - log_debug_errno(r, "Failed to determine peer groups list: %m"); - - b->n_groups = (size_t) -1; - } else + if (r >= 0) b->n_groups = (size_t) r; + else if (!IN_SET(r, -EOPNOTSUPP, -ENOPROTOOPT)) + log_debug_errno(r, "Failed to determine peer's group list: %m"); } static int bus_socket_start_auth_client(sd_bus *b) {