]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Switch fake_ctdbd to use ctdb_get_peer_pid()
authorMartin Schwenke <martin@meltin.net>
Fri, 8 Jun 2018 12:31:48 +0000 (22:31 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 2 Jul 2018 06:51:21 +0000 (08:51 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/src/fake_ctdbd.c

index 7d18de4cc9dc7f0ba93ad49b46d010afa76ac570..678116de5a4bc4687fa7846606f053d8094aa8a2 100644 (file)
@@ -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);