diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-05-07 12:33:18 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-05-07 12:33:18 +0200 |
commit | 442dad3521cfb2e4b1f352583db13caf8bd1f128 (patch) | |
tree | 1075e5f85a365e5698748e072daf6f6db7e2c6f2 /runtime/nsd_gtls.c | |
parent | 773ec2bb0a7fcb5cfead5e762896c6179eb63388 (diff) | |
download | rsyslog-442dad3521cfb2e4b1f352583db13caf8bd1f128.tar.gz rsyslog-442dad3521cfb2e4b1f352583db13caf8bd1f128.tar.xz rsyslog-442dad3521cfb2e4b1f352583db13caf8bd1f128.zip |
limited number of unavoidable compiler warnings when compiling with GnuTLS
Diffstat (limited to 'runtime/nsd_gtls.c')
-rw-r--r-- | runtime/nsd_gtls.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c index fd709fe3..a346118b 100644 --- a/runtime/nsd_gtls.c +++ b/runtime/nsd_gtls.c @@ -221,6 +221,19 @@ gtlsEndSess(nsd_gtls_t *pThis) } +/* a small wrapper for gnutls_transport_set_ptr(). The main intension for + * creating this wrapper is to get the annoying "cast to pointer from different + * size" compiler warning just once. There seems to be no way around it, see: + * http://lists.gnu.org/archive/html/help-gnutls/2008-05/msg00000.html + * rgerhards, 2008.05-07 + */ +static inline void +gtlsSetTransportPtr(nsd_gtls_t *pThis, int sock) +{ + /* Note: the compiler warning for the next line is OK - see header comment! */ + gnutls_transport_set_ptr(pThis->sess, (gnutls_transport_ptr_t) sock); +} + /* ---------------------------- end GnuTLS specifics ---------------------------- */ @@ -378,7 +391,7 @@ AcceptConnReq(nsd_t *pNsd, nsd_t **ppNew) /* if we reach this point, we are in TLS mode */ CHKiRet(gtlsInitSession(pNew)); - gnutls_transport_set_ptr(pNew->sess, (gnutls_transport_ptr_t)((nsd_ptcp_t*) (pNew->pTcp))->sock); + gtlsSetTransportPtr(pNew, ((nsd_ptcp_t*) (pNew->pTcp))->sock); /* we now do the handshake. This is a bit complicated, because we are * on non-blocking sockets. Usually, the handshake will not complete @@ -509,7 +522,7 @@ Connect(nsd_t *pNsd, int family, uchar *port, uchar *host) /* assign the socket to GnuTls */ CHKiRet(nsd_ptcp.GetSock(pThis->pTcp, &sock)); - gnutls_transport_set_ptr(pThis->sess, (gnutls_transport_ptr_t)sock); + gtlsSetTransportPtr(pThis, sock); /* and perform the handshake */ CHKgnutls(gnutls_handshake(pThis->sess)); |