]> git.eshelyaron.com Git - emacs.git/commitdiff
* gnutls.c (emacs_gnutls_handshake): Don't return a garbage value.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Apr 2011 07:12:16 +0000 (00:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 26 Apr 2011 07:12:16 +0000 (00:12 -0700)
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.

src/ChangeLog
src/gnutls.c

index 6614375a7c6fd0fe0690844b8ec3e8aaf2016fac..8bdc3861f9bf1dbf643dacb30d0ac0b4ee1ba03c 100644 (file)
@@ -1,5 +1,11 @@
 2011-04-26  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * 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
index ea0a98570351abfcb45e0cf550ed4a6c19978585..e75d8e717575fd2a3cdb77b2a36f2435f59afd85 100644 (file)
@@ -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);