# HG changeset patch # User Richard M. Stallman # Date 804447050 0 # Node ID 14792ea851f91b22eede859ddc5263c4dd2e0b72 # Parent d6d785d9645518a120b5318ea471fa062e96b209 (child_setup): Don't get confused if in == err. diff -r d6d785d96455 -r 14792ea851f9 src/callproc.c --- 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);