From ee13774efa2ac4b288f339c668b6002e27fbbe8f Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 24 Jul 2019 20:33:18 -0400 Subject: [PATCH] Fix subproc listening when setting filter to non-t (Bug#36591) * src/process.c (Fset_process_filter): Call add_process_read_fd according to the state of process filter before it's updated. This restores the correct functioning as it was before 2016-02-16 "Allow setting the filter masks later". Inline the set_process_filter_masks call instead of fixing it that function, because it is also called from connect_network_socket, and we don't want to change the behavior of that function so close to release. --- src/process.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/process.c b/src/process.c index 2df51cfd99..b602507765 100644 --- a/src/process.c +++ b/src/process.c @@ -1268,10 +1268,19 @@ DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter, if (NILP (filter)) filter = Qinternal_default_process_filter; - pset_filter (p, filter); - if (p->infd >= 0) - set_process_filter_masks (p); + { + /* If filter WILL be t, stop reading output. */ + if (EQ (filter, Qt) && !EQ (p->status, Qlisten)) + delete_read_fd (p->infd); + else if (/* If filter WAS t, then resume reading output. */ + EQ (p->filter, Qt) + /* Network or serial process not stopped: */ + && !EQ (p->command, Qt)) + add_process_read_fd (p->infd); + } + + pset_filter (p, filter); if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p)) pset_childp (p, Fplist_put (p->childp, QCfilter, filter)); -- 2.11.0