comparison src/process.c @ 110648:256dd50b2a63

Make sure all reads/writes to gnutls streams go via the gnutls functions.
author Lars Magne Ingebrigtsen <larsi@gnus.org>
date Wed, 29 Sep 2010 14:48:29 +0200
parents ddf04bc5ad27
children 3bc79f337a57
comparison
equal deleted inserted replaced
110647:c294bdb9cef3 110648:256dd50b2a63
670 #endif 670 #endif
671 671
672 #ifdef HAVE_GNUTLS 672 #ifdef HAVE_GNUTLS
673 p->gnutls_initstage = GNUTLS_STAGE_EMPTY; 673 p->gnutls_initstage = GNUTLS_STAGE_EMPTY;
674 p->gnutls_log_level = 0; 674 p->gnutls_log_level = 0;
675 p->gnutls_p = 0;
675 #endif 676 #endif
676 677
677 /* If name is already in use, modify it until it is unused. */ 678 /* If name is already in use, modify it until it is unused. */
678 679
679 name1 = name; 680 name1 = name;
5201 else 5202 else
5202 #endif 5203 #endif
5203 if (proc_buffered_char[channel] < 0) 5204 if (proc_buffered_char[channel] < 0)
5204 { 5205 {
5205 #ifdef HAVE_GNUTLS 5206 #ifdef HAVE_GNUTLS
5206 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) 5207 if (XPROCESS (proc)->gnutls_p)
5207 nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, 5208 nbytes = emacs_gnutls_read (channel, XPROCESS (proc),
5208 chars + carryover, readmax); 5209 chars + carryover, readmax);
5209 else 5210 else
5210 #endif 5211 #endif
5211 nbytes = emacs_read (channel, chars + carryover, readmax); 5212 nbytes = emacs_read (channel, chars + carryover, readmax);
5212 #ifdef ADAPTIVE_READ_BUFFERING 5213 #ifdef ADAPTIVE_READ_BUFFERING
5240 else 5241 else
5241 { 5242 {
5242 chars[carryover] = proc_buffered_char[channel]; 5243 chars[carryover] = proc_buffered_char[channel];
5243 proc_buffered_char[channel] = -1; 5244 proc_buffered_char[channel] = -1;
5244 #ifdef HAVE_GNUTLS 5245 #ifdef HAVE_GNUTLS
5245 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) 5246 if (XPROCESS (proc)->gnutls_p)
5246 nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, 5247 nbytes = emacs_gnutls_read (channel, XPROCESS (proc),
5247 chars + carryover + 1, readmax - 1); 5248 chars + carryover + 1, readmax - 1);
5248 else 5249 else
5249 #endif 5250 #endif
5250 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); 5251 nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1);
5251 if (nbytes < 0) 5252 if (nbytes < 0)
5656 } 5657 }
5657 else 5658 else
5658 #endif 5659 #endif
5659 { 5660 {
5660 #ifdef HAVE_GNUTLS 5661 #ifdef HAVE_GNUTLS
5661 if (NETCONN_P(proc) && GNUTLS_PROCESS_USABLE (proc)) 5662 if (XPROCESS (proc)->gnutls_p)
5662 rv = emacs_gnutls_write (outfd, 5663 rv = emacs_gnutls_write (outfd,
5663 XPROCESS (proc)->gnutls_state, 5664 XPROCESS (proc),
5664 (char *) buf, this); 5665 (char *) buf, this);
5665 else 5666 else
5666 #endif 5667 #endif
5667 rv = emacs_write (outfd, (char *) buf, this); 5668 rv = emacs_write (outfd, (char *) buf, this);
5668 #ifdef ADAPTIVE_READ_BUFFERING 5669 #ifdef ADAPTIVE_READ_BUFFERING