diff options
| author | Eli Zaretskii | 2023-10-06 08:31:59 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-10-06 08:31:59 +0300 |
| commit | 1594d5f17ad9845be526381e6cd62313da41590a (patch) | |
| tree | a5b0962cf54e13716c3580b078b00857cfef3e3b /src | |
| parent | aad8b5d78f306ac9ca0c03734524c9f49585bee8 (diff) | |
| download | emacs-1594d5f17ad9845be526381e6cd62313da41590a.tar.gz emacs-1594d5f17ad9845be526381e6cd62313da41590a.zip | |
Fix setting the pipe capacity for subprocesses
* src/process.c (create_process) [F_SETPIPE_SZ]: Set the pipe
capacity only if the required read-process-max is larger than the
default capacity of the pipe. (Bug#66288)
Diffstat (limited to 'src')
| -rw-r--r-- | src/process.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index 67d1d3e425f..5f7408a9395 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2189,8 +2189,14 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2189 | inchannel = p->open_fd[READ_FROM_SUBPROCESS]; | 2189 | inchannel = p->open_fd[READ_FROM_SUBPROCESS]; |
| 2190 | forkout = p->open_fd[SUBPROCESS_STDOUT]; | 2190 | forkout = p->open_fd[SUBPROCESS_STDOUT]; |
| 2191 | 2191 | ||
| 2192 | #if defined(GNU_LINUX) && defined(F_SETPIPE_SZ) | 2192 | #if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ) |
| 2193 | fcntl (inchannel, F_SETPIPE_SZ, read_process_output_max); | 2193 | /* If they requested larger reads than the default system pipe |
| 2194 | capacity, try enlarging the capacity to match the request. */ | ||
| 2195 | if (read_process_output_max > fcntl (inchannel, F_GETPIPE_SZ)) | ||
| 2196 | { | ||
| 2197 | int readmax = clip_to_bounds (1, read_process_output_max, INT_MAX); | ||
| 2198 | fcntl (inchannel, F_SETPIPE_SZ, readmax); | ||
| 2199 | } | ||
| 2194 | #endif | 2200 | #endif |
| 2195 | } | 2201 | } |
| 2196 | 2202 | ||