diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/process.c b/src/process.c index d05071824de..ef0cd07d883 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2807,15 +2807,17 @@ read_process_output (proc, channel) | |||
| 2807 | proc_decode_coding_system[channel] here. It is done in | 2807 | proc_decode_coding_system[channel] here. It is done in |
| 2808 | detect_coding called via decode_coding above. */ | 2808 | detect_coding called via decode_coding above. */ |
| 2809 | 2809 | ||
| 2810 | /* If coding-system for encoding is not yet decided, we set it | 2810 | /* If coding-system for encoding is not yet decided, we set |
| 2811 | as the same as coding-system for decoding. */ | 2811 | it as the same as coding-system for decoding. |
| 2812 | if (NILP (p->encode_coding_system)) | 2812 | |
| 2813 | But, before doing that we must check if | ||
| 2814 | proc_encode_coding_system[p->outfd] surely points to a | ||
| 2815 | valid memory because p->outfd will be changed once EOF is | ||
| 2816 | sent to the process. */ | ||
| 2817 | if (NILP (p->encode_coding_system) | ||
| 2818 | && proc_encode_coding_system[p->outfd]) | ||
| 2813 | { | 2819 | { |
| 2814 | p->encode_coding_system = coding->symbol; | 2820 | p->encode_coding_system = coding->symbol; |
| 2815 | if (!proc_encode_coding_system[p->outfd]) | ||
| 2816 | proc_encode_coding_system[p->outfd] | ||
| 2817 | = ((struct coding_system *) | ||
| 2818 | xmalloc (sizeof (struct coding_system))); | ||
| 2819 | setup_coding_system (coding->symbol, | 2821 | setup_coding_system (coding->symbol, |
| 2820 | proc_encode_coding_system[p->outfd]); | 2822 | proc_encode_coding_system[p->outfd]); |
| 2821 | } | 2823 | } |
| @@ -2846,6 +2848,8 @@ read_process_output (proc, channel) | |||
| 2846 | } | 2848 | } |
| 2847 | #endif | 2849 | #endif |
| 2848 | 2850 | ||
| 2851 | Vlast_coding_system_used = coding->symbol; | ||
| 2852 | |||
| 2849 | outstream = p->filter; | 2853 | outstream = p->filter; |
| 2850 | if (!NILP (outstream)) | 2854 | if (!NILP (outstream)) |
| 2851 | { | 2855 | { |
| @@ -3047,6 +3051,8 @@ send_process (proc, buf, len, object) | |||
| 3047 | error ("Output file descriptor of %s is closed", procname); | 3051 | error ("Output file descriptor of %s is closed", procname); |
| 3048 | 3052 | ||
| 3049 | coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; | 3053 | coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; |
| 3054 | Vlast_coding_system_used = coding->symbol; | ||
| 3055 | |||
| 3050 | if (CODING_REQUIRE_ENCODING (coding)) | 3056 | if (CODING_REQUIRE_ENCODING (coding)) |
| 3051 | { | 3057 | { |
| 3052 | int require = encoding_buffer_size (coding, len); | 3058 | int require = encoding_buffer_size (coding, len); |