diff options
| author | Richard M. Stallman | 1995-06-29 17:30:50 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-06-29 17:30:50 +0000 |
| commit | f29f9e4afc2a54e937e0403555a41734599725be (patch) | |
| tree | 2fcec67625920311c33d8d0e3671a05c89bf4b6b /src | |
| parent | 1e87252ca9504752162df693e84e9dc3b94fe3bb (diff) | |
| download | emacs-f29f9e4afc2a54e937e0403555a41734599725be.tar.gz emacs-f29f9e4afc2a54e937e0403555a41734599725be.zip | |
(child_setup): Don't get confused if in == err.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/callproc.c b/src/callproc.c index f87223c8d44..ea995b6b09f 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -807,14 +807,25 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) | |||
| 807 | descriptors zero, one, or two; this could happen if Emacs is | 807 | descriptors zero, one, or two; this could happen if Emacs is |
| 808 | started with its standard in, out, or error closed, as might | 808 | started with its standard in, out, or error closed, as might |
| 809 | happen under X. */ | 809 | happen under X. */ |
| 810 | in = relocate_fd (in, 3); | 810 | { |
| 811 | if (out == err) | 811 | int oin = in, oout = out; |
| 812 | err = out = relocate_fd (out, 3); | 812 | |
| 813 | else | 813 | /* We have to avoid relocating the same descriptor twice! */ |
| 814 | { | 814 | |
| 815 | in = relocate_fd (in, 3); | ||
| 816 | |||
| 817 | if (out == oin) | ||
| 818 | out = in; | ||
| 819 | else | ||
| 815 | out = relocate_fd (out, 3); | 820 | out = relocate_fd (out, 3); |
| 821 | |||
| 822 | if (err == oin) | ||
| 823 | err = in; | ||
| 824 | else if (err == oout) | ||
| 825 | err = out; | ||
| 826 | else | ||
| 816 | err = relocate_fd (err, 3); | 827 | err = relocate_fd (err, 3); |
| 817 | } | 828 | } |
| 818 | 829 | ||
| 819 | close (0); | 830 | close (0); |
| 820 | close (1); | 831 | close (1); |