diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-01-09 09:36:10 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-01-09 09:36:10 -0800 |
commit | 35cf62d95cdcd5323dcea4a5385942c342ff1d9c (patch) | |
tree | 90358cbb033a126c4d48793a80fd804b7baaca24 /src/gnutls.c | |
parent | 59815c02506eb39b61e672528ed03885749ba529 (diff) | |
parent | 7655cb66d86564e792b825f1a0e1a4de7d6e6db5 (diff) | |
download | emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.tar.gz emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.tar.bz2 emacs-35cf62d95cdcd5323dcea4a5385942c342ff1d9c.zip |
Merge from trunk.
Diffstat (limited to 'src/gnutls.c')
-rw-r--r-- | src/gnutls.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gnutls.c b/src/gnutls.c index 9dda184d251..99992e06cdc 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1,5 +1,5 @@ /* GnuTLS glue for GNU Emacs. - Copyright (C) 2010-2011 Free Software Foundation, Inc. + Copyright (C) 2010-2012 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -125,6 +125,7 @@ DEF_GNUTLS_FN (ssize_t, gnutls_record_send, (gnutls_session_t, const void *, size_t)); DEF_GNUTLS_FN (const char *, gnutls_strerror, (int)); DEF_GNUTLS_FN (void, gnutls_transport_set_errno, (gnutls_session_t, int)); +DEF_GNUTLS_FN (const char *, gnutls_check_version, (const char *)); DEF_GNUTLS_FN (void, gnutls_transport_set_lowat, (gnutls_session_t, int)); DEF_GNUTLS_FN (void, gnutls_transport_set_ptr2, (gnutls_session_t, gnutls_transport_ptr_t, @@ -184,7 +185,11 @@ init_gnutls_functions (Lisp_Object libraries) LOAD_GNUTLS_FN (library, gnutls_record_send); LOAD_GNUTLS_FN (library, gnutls_strerror); LOAD_GNUTLS_FN (library, gnutls_transport_set_errno); - LOAD_GNUTLS_FN (library, gnutls_transport_set_lowat); + LOAD_GNUTLS_FN (library, gnutls_check_version); + /* We don't need to call gnutls_transport_set_lowat in GnuTLS 2.11.1 + and later, and the function was removed entirely in 3.0.0. */ + if (!fn_gnutls_check_version ("2.11.1")) + LOAD_GNUTLS_FN (library, gnutls_transport_set_lowat); LOAD_GNUTLS_FN (library, gnutls_transport_set_ptr2); LOAD_GNUTLS_FN (library, gnutls_transport_set_pull_function); LOAD_GNUTLS_FN (library, gnutls_transport_set_push_function); @@ -282,7 +287,12 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) (Note: this is probably not strictly necessary as the lowat value is only used when no custom pull/push functions are set.) */ - fn_gnutls_transport_set_lowat (state, 0); + /* According to GnuTLS NEWS file, lowat level has been set to + zero by default in version 2.11.1, and the function + gnutls_transport_set_lowat was removed from the library in + version 2.99.0. */ + if (!fn_gnutls_check_version ("2.11.1")) + fn_gnutls_transport_set_lowat (state, 0); #else /* This is how GnuTLS takes sockets: as file descriptors passed in. For an Emacs process socket, infd and outfd are the |