From 18ca1593c62d62bb72b4e7e14347cd221c187138 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 26 Nov 2015 18:16:13 +0100 Subject: Protect connect system hook against blocking (nPth). * src/assuan.h.in (ASSUAN_SYSTEM_NPTH_IMPL): Add wrapper for connect. Signed-off-by: Werner Koch --- NEWS | 3 +++ src/assuan.h.in | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 786297b..7168207 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Noteworthy changes in version 2.4.2 (unreleased) [C7/A7/R_] ------------------------------------------------ + * The nPth version of the connect system hook does now wrap the call + with npth_unprotec/npth_protect to avoid blocking during a connect. + Noteworthy changes in version 2.4.1 (2015-11-23) [C7/A7/R1] ------------------------------------------------ diff --git a/src/assuan.h.in b/src/assuan.h.in index 67a1c20..da1af25 100644 --- a/src/assuan.h.in +++ b/src/assuan.h.in @@ -571,13 +571,18 @@ extern struct assuan_system_hooks _assuan_system_pth; { pid_t res; (void) ctx; npth_unprotect(); \ res = __assuan_waitpid (ctx, pid, nowait, status, options); \ npth_protect(); return res; } \ + static int _assuan_npth_connect (assuan_context_t ctx, int sock, \ + struct sockaddr *addr, socklen_t len)\ + { int res; npth_unprotect(); \ + res = __assuan_connect (ctx, sock, addr, len); \ + npth_protect(); return res; } \ \ struct assuan_system_hooks _assuan_system_npth = \ { ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_npth_usleep, __assuan_pipe, \ __assuan_close, _assuan_npth_read, _assuan_npth_write, \ _assuan_npth_recvmsg, _assuan_npth_sendmsg, \ __assuan_spawn, _assuan_npth_waitpid, __assuan_socketpair, \ - __assuan_socket, __assuan_connect } + __assuan_socket, _assuan_npth_connect } extern struct assuan_system_hooks _assuan_system_npth; #define ASSUAN_SYSTEM_NPTH &_assuan_system_npth -- cgit v1.2.3