diff options
| author | Florian Westphal <fw@strlen.de> | 2008-10-29 23:51:39 +0100 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2008-10-29 23:51:39 +0100 |
| commit | 125c05fba0315da143c3431a41bd930fcb992501 (patch) | |
| tree | da710ad800de989d5db396a1bca0ef3dfb4db782 | |
| parent | fb19b05e1e3d638062dcfc4c263b02e7429c4d20 (diff) | |
| download | ngircd-125c05fba0315da143c3431a41bd930fcb992501.tar.gz ngircd-125c05fba0315da143c3431a41bd930fcb992501.zip | |
conn-ssl.c: work around gnutls API problems on 64 bit platforms
Alexander Barton reported a compiler warning on 64-bit platforms: cc1: warnings being treated as errors conn-ssl.c: In function 'ConnSSL_Init_SSL': conn-ssl.c:403: error: cast to pointer from integer of different size Unfortunately, I couldn't find a real solution; the GNUTLS API expects 'gnutls_transport_ptr_t' (which is void*), but the default push/pull functions (send/recv) expect an int. The only alternative solution is to pass in an address to the file descriptor, then add send/recv wrappers that expect a pointer. What a mess[tm].
| -rw-r--r-- | src/ngircd/conn-ssl.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ngircd/conn-ssl.c b/src/ngircd/conn-ssl.c index 5a100072..cd7abd4b 100644 --- a/src/ngircd/conn-ssl.c +++ b/src/ngircd/conn-ssl.c @@ -400,7 +400,13 @@ ConnSSL_Init_SSL(CONNECTION *c) Log(LOG_ERR, "gnutls_set_default_priority: %s", gnutls_strerror(ret)); ConnSSL_Free(c); } - gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) c->sock); + /* + * The intermediate (long) cast is here to avoid a warning like: + * "cast to pointer from integer of different size" on 64-bit platforms. + * There doesn't seem to be an alternate GNUTLS API we could use instead, see e.g. + * http://www.mail-archive.com/help-gnutls@gnu.org/msg00286.html + */ + gnutls_transport_set_ptr(c->ssl_state.gnutls_session, (gnutls_transport_ptr_t) (long) c->sock); ret = gnutls_credentials_set(c->ssl_state.gnutls_session, GNUTLS_CRD_CERTIFICATE, x509_cred); if (ret < 0) { Log(LOG_ERR, "gnutls_credentials_set: %s", gnutls_strerror(ret)); |