diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-02 10:56:57 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-02 10:56:57 +0200 |
commit | 0191f6b8a8c629f9d84efdb607b6971dc8323707 (patch) | |
tree | 3fee9ff12a2e9761f4c198bb21e48d940585fbae /runtime/net.c | |
parent | 86f76c1299b7827549a0cd754960347af627e18d (diff) | |
parent | 09d2e1c707d6cdb6841559e69591c57536b998b7 (diff) | |
download | rsyslog-0191f6b8a8c629f9d84efdb607b6971dc8323707.tar.gz rsyslog-0191f6b8a8c629f9d84efdb607b6971dc8323707.tar.xz rsyslog-0191f6b8a8c629f9d84efdb607b6971dc8323707.zip |
Merge branch 'master' into helgrind
Diffstat (limited to 'runtime/net.c')
-rw-r--r-- | runtime/net.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/runtime/net.c b/runtime/net.c index 85d6813b..38b41389 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -450,6 +450,27 @@ static inline void MaskIP4 (struct in_addr *addr, uint8_t bits) { #define SIN(sa) ((struct sockaddr_in *)(sa)) #define SIN6(sa) ((struct sockaddr_in6 *)(sa)) + +/* This is a cancel-safe getnameinfo() version, because we learned + * (via drd/valgrind) that getnameinfo() seems to have some issues + * when being cancelled, at least if the module was dlloaded. + * rgerhards, 2008-09-30 + */ +static inline int +mygetnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + int iCancelStateSave; + int i; + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave); + i = getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); + pthread_setcancelstate(iCancelStateSave, NULL); + return i; +} + + /* This function adds an allowed sender entry to the ACL linked list. * In any case, a single entry is added. If an error occurs, the * function does its error reporting itself. All validity checks |