From: Zbigniew Jędrzejewski-Szmek Date: Thu, 4 Jan 2018 14:28:57 +0000 (+0100) Subject: bus-socket: slight simplification in bus_get_peercred() X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d98b55ffc2ff634e65405d58cac9e0324124c700;p=elogind.git bus-socket: slight simplification in bus_get_peercred() --- diff --git a/src/libelogind/sd-bus/bus-socket.c b/src/libelogind/sd-bus/bus-socket.c index f930ba93f..bc64779d3 100644 --- a/src/libelogind/sd-bus/bus-socket.c +++ b/src/libelogind/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) {