]> code.delx.au - gnu-emacs/blobdiff - src/gnutls.c
* callint.c (Fcall_interactively): <, not <=, for optimization.
[gnu-emacs] / src / gnutls.c
index 577cca247eeede3c8315391faa806aeea1059886..3a461891e2e8c4975458329ae309b6603446758f 100644 (file)
@@ -1,5 +1,5 @@
 /* GnuTLS glue for GNU Emacs.
-   Copyright (C) 2010  Free Software Foundation, Inc.
+   Copyright (C) 2010-2011  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -125,8 +125,13 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
   rtnval = gnutls_read (state, buf, nbyte);
   if (rtnval >= 0)
     return rtnval;
-  else
-    return -1;
+  else {
+    if (rtnval == GNUTLS_E_AGAIN ||
+       rtnval == GNUTLS_E_INTERRUPTED)
+      return -1;
+    else
+      return 0;
+  }
 }
 
 /* convert an integer error to a Lisp_Object; it will be either a
@@ -443,7 +448,7 @@ one trustfile (usually a CA bundle).  */)
                 (x509_cred,
                  SDATA (trustfile),
                  file_format);
-              
+
               if (ret < GNUTLS_E_SUCCESS)
                 return gnutls_make_error (ret);
             }
@@ -465,7 +470,7 @@ one trustfile (usually a CA bundle).  */)
                 (x509_cred,
                  SDATA (keyfile),
                  file_format);
-              
+
               if (ret < GNUTLS_E_SUCCESS)
                 return gnutls_make_error (ret);
             }
@@ -492,7 +497,7 @@ one trustfile (usually a CA bundle).  */)
 
   if (STRINGP (priority_string))
     {
-      priority_string_ptr = (char*) SDATA (priority_string);
+      priority_string_ptr = SSDATA (priority_string);
       GNUTLS_LOG2 (1, max_log_level, "got non-default priority string:",
                    priority_string_ptr);
     }
@@ -501,7 +506,7 @@ one trustfile (usually a CA bundle).  */)
       GNUTLS_LOG2 (1, max_log_level, "using default priority string:",
                    priority_string_ptr);
     }
-  
+
   GNUTLS_LOG (1, max_log_level, "setting the priority string");
 
   ret = gnutls_priority_set_direct (state,