diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-03-07 12:55:29 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-03-07 12:55:29 +0000 |
commit | 471f86b9a3d57ba805f14e21fbc8d462c6802df5 (patch) | |
tree | 3bd2b3b0961bf7555990e40b0bbdc2c17626263c /src | |
parent | 2ad02767327ec06cf09fe6df991d425183797387 (diff) | |
download | emacs-471f86b9a3d57ba805f14e21fbc8d462c6802df5.tar.gz |
(Fset_process_filter): Don't crash if the input
file descriptor of PROCESS is closed.
(Fset_process_window_size): Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/process.c | 40 |
2 files changed, 35 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bb6859cf6a5..ed40b909eac 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-03-07 Gerd Moellmann <gerd@gnu.org> + + * process.c (Fset_process_filter): Don't crash if the input + file descriptor of PROCESS is closed. + (Fset_process_window_size): Likewise. + 2001-03-06 Kenichi Handa <handa@etl.go.jp> * xterm.c (XTflash): Make the timeout of select shorter, and call diff --git a/src/process.c b/src/process.c index b41478c0bd3..f1541800004 100644 --- a/src/process.c +++ b/src/process.c @@ -734,18 +734,34 @@ If the process has a filter, its buffer is not used for output.") (process, filter) register Lisp_Object process, filter; { + struct Lisp_Process *p; + CHECK_PROCESS (process, 0); - if (EQ (filter, Qt)) - { - FD_CLR (XINT (XPROCESS (process)->infd), &input_wait_mask); - FD_CLR (XINT (XPROCESS (process)->infd), &non_keyboard_wait_mask); - } - else if (EQ (XPROCESS (process)->filter, Qt)) + p = XPROCESS (process); + + /* Don't signal an error if the process' input file descriptor + is closed. This could make debugging Lisp more difficult, + for example when doing something like + + (setq process (start-process ...)) + (debug) + (set-process-filter process ...) */ + + if (XINT (p->infd) >= 0) { - FD_SET (XINT (XPROCESS (process)->infd), &input_wait_mask); - FD_SET (XINT (XPROCESS (process)->infd), &non_keyboard_wait_mask); + if (EQ (filter, Qt)) + { + FD_CLR (XINT (p->infd), &input_wait_mask); + FD_CLR (XINT (p->infd), &non_keyboard_wait_mask); + } + else if (EQ (XPROCESS (process)->filter, Qt)) + { + FD_SET (XINT (p->infd), &input_wait_mask); + FD_SET (XINT (p->infd), &non_keyboard_wait_mask); + } } - XPROCESS (process)->filter = filter; + + p->filter = filter; return filter; } @@ -793,8 +809,10 @@ DEFUN ("set-process-window-size", Fset_process_window_size, CHECK_PROCESS (process, 0); CHECK_NATNUM (height, 0); CHECK_NATNUM (width, 0); - if (set_window_size (XINT (XPROCESS (process)->infd), - XINT (height), XINT (width)) <= 0) + + if (XINT (XPROCESS (process)->infd < 0) + || set_window_size (XINT (XPROCESS (process)->infd), + XINT (height), XINT (width)) <= 0) return Qnil; else return Qt; |