aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/process.c b/src/process.c
index e9ac324845b..c9c6ab6d4b3 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5368,6 +5368,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5368 /* Send this batch, using one or more write calls. */ 5368 /* Send this batch, using one or more write calls. */
5369 while (this > 0) 5369 while (this > 0)
5370 { 5370 {
5371 EMACS_INT written = 0;
5371 int outfd = p->outfd; 5372 int outfd = p->outfd;
5372 old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap); 5373 old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap);
5373#ifdef DATAGRAM_SOCKETS 5374#ifdef DATAGRAM_SOCKETS
@@ -5376,7 +5377,9 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5376 rv = sendto (outfd, buf, this, 5377 rv = sendto (outfd, buf, this,
5377 0, datagram_address[outfd].sa, 5378 0, datagram_address[outfd].sa,
5378 datagram_address[outfd].len); 5379 datagram_address[outfd].len);
5379 if (rv < 0 && errno == EMSGSIZE) 5380 if (0 <= rv)
5381 written = rv;
5382 else if (errno == EMSGSIZE)
5380 { 5383 {
5381 signal (SIGPIPE, old_sigpipe); 5384 signal (SIGPIPE, old_sigpipe);
5382 report_file_error ("sending datagram", 5385 report_file_error ("sending datagram",
@@ -5388,12 +5391,13 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5388 { 5391 {
5389#ifdef HAVE_GNUTLS 5392#ifdef HAVE_GNUTLS
5390 if (XPROCESS (proc)->gnutls_p) 5393 if (XPROCESS (proc)->gnutls_p)
5391 rv = emacs_gnutls_write (outfd, 5394 written = emacs_gnutls_write (outfd,
5392 XPROCESS (proc), 5395 XPROCESS (proc),
5393 buf, this); 5396 buf, this);
5394 else 5397 else
5395#endif 5398#endif
5396 rv = emacs_write (outfd, buf, this); 5399 written = emacs_write (outfd, buf, this);
5400 rv = (written ? 0 : -1);
5397#ifdef ADAPTIVE_READ_BUFFERING 5401#ifdef ADAPTIVE_READ_BUFFERING
5398 if (p->read_output_delay > 0 5402 if (p->read_output_delay > 0
5399 && p->adaptive_read_buffering == 1) 5403 && p->adaptive_read_buffering == 1)
@@ -5420,7 +5424,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5420 that may allow the program 5424 that may allow the program
5421 to finish doing output and read more. */ 5425 to finish doing output and read more. */
5422 { 5426 {
5423 int offset = 0; 5427 EMACS_INT offset = 0;
5424 5428
5425#ifdef BROKEN_PTY_READ_AFTER_EAGAIN 5429#ifdef BROKEN_PTY_READ_AFTER_EAGAIN
5426 /* A gross hack to work around a bug in FreeBSD. 5430 /* A gross hack to work around a bug in FreeBSD.
@@ -5466,16 +5470,14 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5466 offset); 5470 offset);
5467 else if (STRINGP (object)) 5471 else if (STRINGP (object))
5468 buf = offset + SSDATA (object); 5472 buf = offset + SSDATA (object);
5469
5470 rv = 0;
5471 } 5473 }
5472 else 5474 else
5473 /* This is a real error. */ 5475 /* This is a real error. */
5474 report_file_error ("writing to process", Fcons (proc, Qnil)); 5476 report_file_error ("writing to process", Fcons (proc, Qnil));
5475 } 5477 }
5476 buf += rv; 5478 buf += written;
5477 len -= rv; 5479 len -= written;
5478 this -= rv; 5480 this -= written;
5479 } 5481 }
5480 } 5482 }
5481 } 5483 }