Mercurial > emacs
changeset 12430:14792ea851f9
(child_setup): Don't get confused if in == err.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 29 Jun 1995 17:30:50 +0000 |
parents | d6d785d96455 |
children | 80a5aedfb4c7 |
files | src/callproc.c |
diffstat | 1 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/callproc.c Thu Jun 29 03:21:26 1995 +0000 +++ b/src/callproc.c Thu Jun 29 17:30:50 1995 +0000 @@ -807,14 +807,25 @@ descriptors zero, one, or two; this could happen if Emacs is started with its standard in, out, or error closed, as might happen under X. */ - in = relocate_fd (in, 3); - if (out == err) - err = out = relocate_fd (out, 3); - else - { + { + int oin = in, oout = out; + + /* We have to avoid relocating the same descriptor twice! */ + + in = relocate_fd (in, 3); + + if (out == oin) + out = in; + else out = relocate_fd (out, 3); + + if (err == oin) + err = in; + else if (err == oout) + err = out; + else err = relocate_fd (err, 3); - } + } close (0); close (1);