]> 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)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Jul 2018 08:44:13 +0000 (10:44 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 05a908d71c4b7484ba0243fa51bc05c79c8fb357)

ctdb/tests/src/fake_ctdbd.c

index 2f4e87f6f6c31da0f31b1b3b816c02e48bb7592b..ebb8bec9c127964942c00f2bd1923ba42aae060b 100644 (file)
@@ -40,6 +40,7 @@
 #include "common/logging.h"
 #include "common/tunable.h"
 #include "common/srvid.h"
+#include "common/system.h"
 
 #include "ipalloc_read_known_ips.h"
 
@@ -3050,8 +3051,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);
@@ -3064,12 +3063,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);