From 5a07883f237af80b7d1822a145d66f2c2ee29b43 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Wed, 27 Jun 2018 13:41:10 +1000 Subject: [PATCH 01/13] replace: Add test for sin6_len in sockaddr_in6 structure BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit 7eeba9c5a4541e581b062fb9ee26f13b7373c541) --- lib/replace/wscript | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/replace/wscript b/lib/replace/wscript index 0e04bf7e121..6c7de5953f0 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -632,6 +632,10 @@ removeea setea headers='sys/socket.h netinet/in.h', define='HAVE_SOCK_SIN_LEN') + conf.CHECK_STRUCTURE_MEMBER('struct sockaddr_in6', 'sin6_len', + headers='sys/socket.h netinet/in.h', + define='HAVE_SOCK_SIN6_LEN') + conf.CHECK_CODE('struct sockaddr_un sunaddr; sunaddr.sun_family = AF_UNIX;', define='HAVE_UNIXSOCKET', headers='sys/socket.h sys/un.h') -- 2.17.1 From b215235cdc0a581aa9f04f1abb1f8281bc4fc24f Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Wed, 27 Jun 2018 13:41:38 +1000 Subject: [PATCH 02/13] ctdb-common: Use sin6_len only if the structure supports it BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit 79992dbb73ac9749ac987cb6a88964fa600b4c35) --- ctdb/common/ctdb_util.c | 4 ++-- ctdb/common/system_util.c | 2 +- ctdb/protocol/protocol_util.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 82526b58a19..ffaa1a780ed 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -389,8 +389,8 @@ void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip) sizeof(cip->ip.sin_addr)); } else { cip->ip6.sin6_family = AF_INET6; -#ifdef HAVE_SOCK_SIN_LEN - cip->ip6.sin_len = sizeof(ctdb_sock_addr); +#ifdef HAVE_SOCK_SIN6_LEN + cip->ip6.sin6_len = sizeof(ctdb_sock_addr); #endif cip->ip6.sin6_port = ip->ip6.sin6_port; memcpy(&cip->ip6.sin6_addr, diff --git a/ctdb/common/system_util.c b/ctdb/common/system_util.c index f27eed7038d..f1e9763c52a 100644 --- a/ctdb/common/system_util.c +++ b/ctdb/common/system_util.c @@ -154,7 +154,7 @@ static bool parse_ipv6(const char *s, const char *ifaces, unsigned port, ctdb_so saddr->ip6.sin6_scope_id = if_nametoindex(ifaces); } -#ifdef HAVE_SOCK_SIN_LEN +#ifdef HAVE_SOCK_SIN6_LEN saddr->ip6.sin6_len = sizeof(*saddr); #endif return true; diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index 73652e7f060..c75555fa734 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -206,7 +206,7 @@ static int ipv6_from_string(const char *str, struct sockaddr_in6 *ip6) return EINVAL; } -#ifdef HAVE_SOCK_SIN_LEN +#ifdef HAVE_SOCK_SIN6_LEN ip6->sin6_len = sizeof(*ip6); #endif return 0; -- 2.17.1 From 2c78ae682fc5c1e44a4923434ad80c86ae78bbef Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 29 Jun 2018 15:55:49 +1000 Subject: [PATCH 03/13] ctdb: Fix build on AIX BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit 40a8ab1ce0c1b291af7263da13c25c37cee69670) --- ctdb/server/ctdb_cluster_mutex.c | 4 ++-- ctdb/server/ipalloc.c | 4 ++-- ctdb/tests/src/ctdb_takeover_tests.c | 6 +++--- ctdb/tests/src/ipalloc_read_known_ips.c | 4 ++-- ctdb/tools/ctdb_killtcp.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c index 93977463e0c..804c6d5dd8c 100644 --- a/ctdb/server/ctdb_cluster_mutex.c +++ b/ctdb/server/ctdb_cluster_mutex.c @@ -19,11 +19,11 @@ along with this program; if not, see . */ -#include - #include "replace.h" #include "system/network.h" +#include + #include "lib/util/debug.h" #include "lib/util/time.h" #include "lib/util/strv.h" diff --git a/ctdb/server/ipalloc.c b/ctdb/server/ipalloc.c index caa50224156..a699c144076 100644 --- a/ctdb/server/ipalloc.c +++ b/ctdb/server/ipalloc.c @@ -19,11 +19,11 @@ along with this program; if not, see . */ -#include - #include "replace.h" #include "system/network.h" +#include + #include "lib/util/debug.h" #include "common/logging.h" diff --git a/ctdb/tests/src/ctdb_takeover_tests.c b/ctdb/tests/src/ctdb_takeover_tests.c index ecbc1fd2fba..aec23c0a551 100644 --- a/ctdb/tests/src/ctdb_takeover_tests.c +++ b/ctdb/tests/src/ctdb_takeover_tests.c @@ -17,12 +17,12 @@ along with this program; if not, see . */ -#include -#include - #include "replace.h" #include "system/network.h" +#include +#include + #include "lib/util/debug.h" #include "protocol/protocol.h" diff --git a/ctdb/tests/src/ipalloc_read_known_ips.c b/ctdb/tests/src/ipalloc_read_known_ips.c index 354f7ec4fcd..33d0f940a9d 100644 --- a/ctdb/tests/src/ipalloc_read_known_ips.c +++ b/ctdb/tests/src/ipalloc_read_known_ips.c @@ -17,11 +17,11 @@ along with this program; if not, see . */ -#include - #include "replace.h" #include "system/network.h" +#include + #include "lib/util/debug.h" #include "protocol/protocol.h" diff --git a/ctdb/tools/ctdb_killtcp.c b/ctdb/tools/ctdb_killtcp.c index 71b5999b10e..da497d21d57 100644 --- a/ctdb/tools/ctdb_killtcp.c +++ b/ctdb/tools/ctdb_killtcp.c @@ -17,12 +17,12 @@ along with this program; if not, see . */ -#include -#include - #include "replace.h" #include "system/network.h" +#include +#include + #include "lib/util/debug.h" #include "lib/util/tevent_unix.h" -- 2.17.1 From a26f8fb0854be4dd03026de72f00ed6b09f6eed6 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 29 Jun 2018 16:12:30 +1000 Subject: [PATCH 04/13] tdb: Fix build on AIX BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Here is the build error on AIX 7.1. ../../lib/tdb/tools/tdbtool.c:39:12: error: 'disable_lock' redeclared as different kind of symbol static int disable_lock; ^~~~~~~~~~~~ In file included from /usr/include/sys/gfs.h:24:0, from /usr/include/sys/vfs.h:27, from ../../lib/replace/system/filesys.h:48, from ../../lib/tdb/tools/tdbtool.c:26: /usr/include/sys/lock_def.h:314:5: note: previous declaration of 'disable_lock' was here int disable_lock(int,simple_lock_t); ^~~~~~~~~~~~ Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit edffe4d16514fa0c87655e040842f6c20d89791c) --- lib/tdb/tools/tdbtool.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index e3535b93c7c..7a36ce2b71a 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -36,7 +36,7 @@ char *line; TDB_DATA iterate_kbuf; char cmdline[1024]; static int disable_mmap; -static int disable_lock; +static int _disable_lock; enum commands { CMD_CREATE_TDB, @@ -263,7 +263,7 @@ static void create_tdb(const char *tdbname) tdb = tdb_open_ex(tdbname, 0, TDB_CLEAR_IF_FIRST | (disable_mmap?TDB_NOMMAP:0) | - (disable_lock?TDB_NOLOCK:0), + (_disable_lock?TDB_NOLOCK:0), O_RDWR | O_CREAT | O_TRUNC, 0600, &log_ctx, NULL); if (!tdb) { printf("Could not create %s: %s\n", tdbname, strerror(errno)); @@ -278,7 +278,7 @@ static void open_tdb(const char *tdbname) if (tdb) tdb_close(tdb); tdb = tdb_open_ex(tdbname, 0, (disable_mmap?TDB_NOMMAP:0) | - (disable_lock?TDB_NOLOCK:0), + (_disable_lock?TDB_NOLOCK:0), O_RDWR, 0600, &log_ctx, NULL); @@ -890,7 +890,7 @@ int main(int argc, char *argv[]) arg2len = 0; if (argv[1] && (strcmp(argv[1], "-l") == 0)) { - disable_lock = 1; + _disable_lock = 1; argv[1] = argv[0]; argv += 1; argc -= 1; -- 2.17.1 From 1fd006c8cdbedf15da5c7d6b4688295ec9c857a0 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:08:22 +1000 Subject: [PATCH 05/13] ctdb-common: Use correct return type for tevent_queue_add_entry BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke (cherry picked from commit b977ded38a79e1eadd6965e8b7fd49f86322b4d6) --- ctdb/common/sock_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ctdb/common/sock_io.c b/ctdb/common/sock_io.c index 3f7138f0b7f..e9e2fa3b111 100644 --- a/ctdb/common/sock_io.c +++ b/ctdb/common/sock_io.c @@ -275,7 +275,7 @@ int sock_queue_write(struct sock_queue *queue, uint8_t *buf, size_t buflen) { struct tevent_req *req; struct sock_queue_write_state *state; - bool status; + struct tevent_queue_entry *qentry; if (buflen >= INT32_MAX) { return -1; @@ -289,9 +289,9 @@ int sock_queue_write(struct sock_queue *queue, uint8_t *buf, size_t buflen) state->pkt = buf; state->pkt_size = (uint32_t)buflen; - status = tevent_queue_add_entry(queue->queue, queue->ev, req, + qentry = tevent_queue_add_entry(queue->queue, queue->ev, req, sock_queue_trigger, queue); - if (! status) { + if (qentry == NULL) { talloc_free(req); return -1; } -- 2.17.1 From d2bbbbfd1d741e37512a09ebb66459646b7b4012 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 13:56:13 +1000 Subject: [PATCH 06/13] wafsamba: Add strict option to CHECK_CODE Some compilers (e.g. xlc) ignores unsupported features, generates a warning, but does not fail compilation. This ensures that any compiler warnings are treated as errors and the feature support is correctly identified. This adds equivalent compiler option to -Werror for xlc. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit c08d65c3eea997d52e311f027d84bdc3f9c93059) --- buildtools/wafsamba/samba_autoconf.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index cc08e0d5c3d..1b1e88a0d69 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -365,7 +365,7 @@ def CHECK_CODE(conf, code, define, headers=None, msg=None, cflags='', includes='# .', local_include=True, lib=None, link=True, define_ret=False, quote=False, - on_target=True): + on_target=True, strict=False): '''check if some code compiles and/or runs''' if CONFIG_SET(conf, define): @@ -395,6 +395,16 @@ def CHECK_CODE(conf, code, define, cflags = TO_LIST(cflags) + # Be strict when relying on a compiler check + # Some compilers (e.g. xlc) ignore non-supported features as warnings + if strict: + extra_cflags = None + if conf.env["CC_NAME"] == "gcc": + extra_cflags = "-Werror" + elif conf.env["CC_NAME"] == "xlc": + extra_cflags = "-qhalt=w" + cflags.append(extra_cflags) + if local_include: cflags.append('-I%s' % conf.curdir) -- 2.17.1 From 42c121260aa38834553d47ce5e49de7e8f6a1eba Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:34:29 +1000 Subject: [PATCH 07/13] wafsamba: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit a9775c2429554e029164ad9b98dc8c8c749c50fe) --- buildtools/wafsamba/wscript | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index 3b36b57051e..1567c4bb537 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -374,6 +374,7 @@ def configure(conf): conf.CHECK_CODE('''int main(void) { return 0; } __attribute__((visibility("default"))) void vis_foo2(void) {}''', cflags=conf.env.VISIBILITY_CFLAGS, + strict=True, define='HAVE_VISIBILITY_ATTR', addmain=False) # check HAVE_CONSTRUCTOR_ATTRIBUTE @@ -391,6 +392,7 @@ def configure(conf): ''', 'HAVE_CONSTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library constructor support') # check HAVE_DESTRUCTOR_ATTRIBUTE @@ -408,6 +410,7 @@ def configure(conf): ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library destructor support') conf.CHECK_CODE(''' @@ -424,6 +427,7 @@ def configure(conf): ''', 'HAVE___ATTRIBUTE__', addmain=False, + strict=True, msg='Checking for __attribute__') if sys.platform.startswith('aix'): -- 2.17.1 From 7058950b556754799434406ef49a9b4eca93ebb8 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:36:16 +1000 Subject: [PATCH 08/13] socket_wrapper: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit 77cdfe3ecc06a9aef9ea4201a1a76a9a7b47a73f) --- third_party/socket_wrapper/wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/socket_wrapper/wscript b/third_party/socket_wrapper/wscript index 86c9b3b59ed..f48debe8b15 100644 --- a/third_party/socket_wrapper/wscript +++ b/third_party/socket_wrapper/wscript @@ -36,6 +36,7 @@ def configure(conf): ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library destructor support') # check HAVE_FUNCTION_ATTRIBUTE_FORMAT @@ -48,6 +49,7 @@ def configure(conf): ''', 'HAVE_FUNCTION_ATTRIBUTE_FORMAT', addmain=False, + strict=True, msg='Checking for printf format validation support') conf.CHECK_HEADERS('sys/signalfd.h') -- 2.17.1 From e7f98432bc5a41bcc63a3178bd0761797d1f3b1c Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:44:48 +1000 Subject: [PATCH 09/13] nss_wrapper: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit 9a670bde563b269587c051c655a7b3778c008c87) --- third_party/nss_wrapper/wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/nss_wrapper/wscript b/third_party/nss_wrapper/wscript index 90c6e71d6e9..d50dd5cbb17 100644 --- a/third_party/nss_wrapper/wscript +++ b/third_party/nss_wrapper/wscript @@ -38,6 +38,7 @@ def configure(conf): ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library destructor support') # check HAVE_ATTRIBUTE_PRINTF_FORMAT @@ -50,6 +51,7 @@ def configure(conf): ''', 'HAVE_ATTRIBUTE_PRINTF_FORMAT', addmain=False, + strict=True, msg='Checking for printf format validation support') conf.CHECK_FUNCS('gethostbyaddr_r gethostbyname_r') -- 2.17.1 From 91fd14e875d3a357625826dfdc6155da80aefd5d Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:45:04 +1000 Subject: [PATCH 10/13] pam_wrapper: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit 65b0746694a0cbd8f40c5e89dc9a680044f7a1a9) --- third_party/pam_wrapper/wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/pam_wrapper/wscript b/third_party/pam_wrapper/wscript index b9acf1b96eb..24bc4e5672b 100644 --- a/third_party/pam_wrapper/wscript +++ b/third_party/pam_wrapper/wscript @@ -44,6 +44,7 @@ def configure(conf): ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library destructor support') # check HAVE_FUNCTION_ATTRIBUTE_FORMAT @@ -56,6 +57,7 @@ def configure(conf): ''', 'HAVE_FUNCTION_ATTRIBUTE_FORMAT', addmain=False, + strict=True, msg='Checking for printf format validation support') conf.CHECK_HEADERS('security/pam_appl.h') -- 2.17.1 From 583e189d4e9c4878906fc6b33819f9cbc399765f Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:45:24 +1000 Subject: [PATCH 11/13] resolv_wrapper: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider (cherry picked from commit c220e310b40c67b73248141b3af544bad19fd39d) --- third_party/resolv_wrapper/wscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/third_party/resolv_wrapper/wscript b/third_party/resolv_wrapper/wscript index be3e82be3ea..bb7722e9775 100644 --- a/third_party/resolv_wrapper/wscript +++ b/third_party/resolv_wrapper/wscript @@ -36,6 +36,7 @@ def configure(conf): ''', 'HAVE_DESTRUCTOR_ATTRIBUTE', addmain=False, + strict=True, msg='Checking for library destructor support') # check HAVE_ATTRIBUTE_PRINTF_FORMAT @@ -48,6 +49,7 @@ def configure(conf): ''', 'HAVE_ATTRIBUTE_PRINTF_FORMAT', addmain=False, + strict=True, msg='Checking for printf format validation support') conf.CHECK_HEADERS('resolv.h') -- 2.17.1 From b8b8d9fa5085fbeb97a92e33aa93e7e131039ea4 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 3 Jul 2018 14:45:39 +1000 Subject: [PATCH 12/13] uid_wrapper: Be strict when checking __attribute__ features BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493 Signed-off-by: Amitay Isaacs Reviewed-by: Andreas Schneider Autobuild-User(master): Martin Schwenke Autobuild-Date(master): Thu Jul 5 03:01:33 CEST 2018 on sn-devel-144 (cherry picked from commit 734ea271ab01e74d0694f3fbc9acdf980d866b30) --- third_party/uid_wrapper/wscript | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/third_party/uid_wrapper/wscript b/third_party/uid_wrapper/wscript index 6e1540f108d..6344ebf5eba 100644 --- a/third_party/uid_wrapper/wscript +++ b/third_party/uid_wrapper/wscript @@ -51,7 +51,8 @@ def configure(conf): ''', 'HAVE_ADDRESS_SANITIZER_ATTRIBUTE', addmain=False, - cflags='-Wall -Wextra -Werror', + cflags='-Wall -Wextra', + strict=True, msg='Checking for address sanitizer attribute') # check HAVE_FUNCTION_ATTRIBUTE_FORMAT @@ -64,6 +65,7 @@ def configure(conf): ''', 'HAVE_FUNCTION_ATTRIBUTE_FORMAT', addmain=False, + strict=True, msg='Checking for printf format validation support') # Prototype checks conf.CHECK_C_PROTOTYPE('setgroups', -- 2.17.1 From fe05ce84ad87fb9bff22a987564b0591b0341d3b Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 8 Jun 2018 22:31:48 +1000 Subject: [PATCH 13/13] ctdb-tests: Switch fake_ctdbd to use ctdb_get_peer_pid() Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit 05a908d71c4b7484ba0243fa51bc05c79c8fb357) --- ctdb/tests/src/fake_ctdbd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ctdb/tests/src/fake_ctdbd.c b/ctdb/tests/src/fake_ctdbd.c index 2f4e87f6f6c..ebb8bec9c12 100644 --- a/ctdb/tests/src/fake_ctdbd.c +++ b/ctdb/tests/src/fake_ctdbd.c @@ -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); -- 2.17.1