From: Paul Eggert Date: Tue, 26 Apr 2011 07:12:16 +0000 (-0700) Subject: * gnutls.c (emacs_gnutls_handshake): Don't return a garbage value. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~214 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=080e5a8d90830c0d5c9d365e429f748e938a9485;p=emacs.git * gnutls.c (emacs_gnutls_handshake): Don't return a garbage value. Expect the caller to check whether GNUTLS_STAGE_HANDSHAKE_CANDO <= proc->gnutls_initstage, if the check is needed. The check isn't needed for one caller, Fgnutls_boot. (emacs_gnutls_read): Do that check. This is the other caller. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6614375a7c6..8bdc3861f9b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2011-04-26 Paul Eggert + * gnutls.c (emacs_gnutls_handshake): Don't return a garbage value. + Expect the caller to check whether GNUTLS_STAGE_HANDSHAKE_CANDO <= + proc->gnutls_initstage, if the check is needed. The check isn't + needed for one caller, Fgnutls_boot. + (emacs_gnutls_read): Do that check. This is the other caller. + lisp.h: Fix a problem with aliasing and vector headers. GCC 4.6.0 optimizes based on type-based alias analysis. For example, if b is of type struct buffer * and v of type struct diff --git a/src/gnutls.c b/src/gnutls.c index ea0a9857035..e75d8e71757 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -73,9 +73,6 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) gnutls_session_t state = proc->gnutls_state; int ret; - if (proc->gnutls_initstage < GNUTLS_STAGE_HANDSHAKE_CANDO) - return; - if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET) { #ifdef WINDOWSNT @@ -179,7 +176,8 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf, if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { - emacs_gnutls_handshake (proc); + if (GNUTLS_STAGE_HANDSHAKE_CANDO <= proc->gnutls_initstage) + emacs_gnutls_handshake (proc); return -1; } rtnval = gnutls_read (state, buf, nbyte);