From: Martin Schwenke Date: Fri, 8 Jun 2018 12:31:48 +0000 (+1000) Subject: ctdb-tests: Switch fake_ctdbd to use ctdb_get_peer_pid() X-Git-Tag: tevent-0.9.37~176 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=05a908d71c4b7484ba0243fa51bc05c79c8fb357;p=thirdparty%2Fsamba.git ctdb-tests: Switch fake_ctdbd to use ctdb_get_peer_pid() Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/src/fake_ctdbd.c b/ctdb/tests/src/fake_ctdbd.c index 7d18de4cc9d..678116de5a4 100644 --- a/ctdb/tests/src/fake_ctdbd.c +++ b/ctdb/tests/src/fake_ctdbd.c @@ -42,6 +42,7 @@ #include "common/logging.h" #include "common/tunable.h" #include "common/srvid.h" +#include "common/system.h" #include "ipalloc_read_known_ips.h" @@ -3700,8 +3701,6 @@ static struct tevent_req *client_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req; struct client_state *state; - struct ucred cr; - socklen_t crl = sizeof(struct ucred); int ret; req = tevent_req_create(mem_ctx, &state, struct client_state); @@ -3714,12 +3713,7 @@ static struct tevent_req *client_send(TALLOC_CTX *mem_ctx, state->ctdb = ctdb; state->pnn = pnn; - ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &crl); - if (ret != 0) { - tevent_req_error(req, ret); - return tevent_req_post(req, ev); - } - state->pid = cr.pid; + (void) ctdb_get_peer_pid(fd, &state->pid); ret = comm_setup(state, ev, fd, client_read_handler, req, client_dead_handler, req, &state->comm);