[PATCH 2/2] ctdb-tests: Use ctdb_get_peer_pid

James Clarke jrtc27 at jrtc27.com
Sun Jul 1 19:16:54 UTC 2018


Signed-off-by: James Clarke <jrtc27 at jrtc27.com>
---
 ctdb/tests/src/fake_ctdbd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/ctdb/tests/src/fake_ctdbd.c b/ctdb/tests/src/fake_ctdbd.c
index 7d18de4cc9d..6ec57be52ba 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,11 @@ 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);
+	ret = ctdb_get_peer_pid(fd, &state->pid);
 	if (ret != 0) {
 		tevent_req_error(req, ret);
 		return tevent_req_post(req, ev);
 	}
-	state->pid = cr.pid;
 
 	ret = comm_setup(state, ev, fd, client_read_handler, req,
 			 client_dead_handler, req, &state->comm);
-- 
2.18.0




More information about the samba-technical mailing list