aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.h
diff options
context:
space:
mode:
authorMatthias Dahl2018-02-16 17:57:40 +0200
committerEli Zaretskii2018-06-02 12:13:12 +0300
commitde69d28458e52487ebb9db47b100c23a16ab6093 (patch)
tree9938cebe8d4d215ca8a86570b7f5e2976307f209 /src/process.h
parent76f692e82f13dc2d36e3636932f3998023a66289 (diff)
downloademacs-de69d28458e52487ebb9db47b100c23a16ab6093.tar.gz
emacs-de69d28458e52487ebb9db47b100c23a16ab6093.zip
Fix wait_reading_process_output wait_proc hang
* src/process.c (read_process_output): Track bytes read from a process. (wait_reading_process_output): If called recursively through timers and/or process filters via accept-process-output, it is possible that the output of wait_proc has already been read by one of those recursive calls, leaving the original call hanging forever if no further output arrives through that fd and no timeout has been set. Fix that by using the process read accounting to keep track of how many bytes have been read and use that as a condition to break out of the infinite loop and return to the caller as well as to calculate the proper return value (if a wait_proc is given that is). * src/process.h (struct Lisp_Process): Add nbytes_read to track bytes read from a process. (cherry picked from commit 4ba32858d61eee16f17b51aca01c15211a0912f8)
Diffstat (limited to 'src/process.h')
-rw-r--r--src/process.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/process.h b/src/process.h
index ab468b18c56..6464a8cc61a 100644
--- a/src/process.h
+++ b/src/process.h
@@ -129,6 +129,8 @@ struct Lisp_Process
129 pid_t pid; 129 pid_t pid;
130 /* Descriptor by which we read from this process. */ 130 /* Descriptor by which we read from this process. */
131 int infd; 131 int infd;
132 /* Byte-count modulo (UINTMAX_MAX + 1) for process output read from `infd'. */
133 uintmax_t nbytes_read;
132 /* Descriptor by which we write to this process. */ 134 /* Descriptor by which we write to this process. */
133 int outfd; 135 int outfd;
134 /* Descriptors that were created for this process and that need 136 /* Descriptors that were created for this process and that need