diff options
| author | Stefan Kangas | 2021-12-12 06:31:07 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2021-12-12 06:31:07 +0100 |
| commit | 2d116c432d2a561fac69916d78b7a70dd6144ac7 (patch) | |
| tree | dd948eabc6fba59704c2a66ea7d97624c86e2228 /src/process.c | |
| parent | 4b29468dbef63f2befd7f67663a11cd5a3009b79 (diff) | |
| parent | 8a0734329a4faf0b45627763af74222bdd0ec143 (diff) | |
| download | emacs-2d116c432d2a561fac69916d78b7a70dd6144ac7.tar.gz emacs-2d116c432d2a561fac69916d78b7a70dd6144ac7.zip | |
Merge from origin/emacs-28
8a0734329a Avoid undefined behavior in 'send-process-region' (Bug#523...
30dd5c9acc Update to Org 9.5.1-25-g9ca3bc
a374849926 Fix the DJGPP port
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c index 483da4d7e4f..76094988f25 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -40,7 +40,10 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 40 | #include <netinet/in.h> | 40 | #include <netinet/in.h> |
| 41 | #include <arpa/inet.h> | 41 | #include <arpa/inet.h> |
| 42 | 42 | ||
| 43 | #endif /* subprocesses */ | 43 | #else |
| 44 | #define PIPECONN_P(p) false | ||
| 45 | #define PIPECONN1_P(p) false | ||
| 46 | #endif | ||
| 44 | 47 | ||
| 45 | #ifdef HAVE_SETRLIMIT | 48 | #ifdef HAVE_SETRLIMIT |
| 46 | # include <sys/resource.h> | 49 | # include <sys/resource.h> |
| @@ -152,6 +155,7 @@ static bool kbd_is_on_hold; | |||
| 152 | when exiting. */ | 155 | when exiting. */ |
| 153 | bool inhibit_sentinels; | 156 | bool inhibit_sentinels; |
| 154 | 157 | ||
| 158 | #ifdef subprocesses | ||
| 155 | union u_sockaddr | 159 | union u_sockaddr |
| 156 | { | 160 | { |
| 157 | struct sockaddr sa; | 161 | struct sockaddr sa; |
| @@ -164,8 +168,6 @@ union u_sockaddr | |||
| 164 | #endif | 168 | #endif |
| 165 | }; | 169 | }; |
| 166 | 170 | ||
| 167 | #ifdef subprocesses | ||
| 168 | |||
| 169 | #ifndef SOCK_CLOEXEC | 171 | #ifndef SOCK_CLOEXEC |
| 170 | # define SOCK_CLOEXEC 0 | 172 | # define SOCK_CLOEXEC 0 |
| 171 | #endif | 173 | #endif |
| @@ -6536,6 +6538,9 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, | |||
| 6536 | /* Send this batch, using one or more write calls. */ | 6538 | /* Send this batch, using one or more write calls. */ |
| 6537 | ptrdiff_t written = 0; | 6539 | ptrdiff_t written = 0; |
| 6538 | int outfd = p->outfd; | 6540 | int outfd = p->outfd; |
| 6541 | if (outfd < 0) | ||
| 6542 | error ("Output file descriptor of %s is closed", | ||
| 6543 | SDATA (p->name)); | ||
| 6539 | eassert (0 <= outfd && outfd < FD_SETSIZE); | 6544 | eassert (0 <= outfd && outfd < FD_SETSIZE); |
| 6540 | #ifdef DATAGRAM_SOCKETS | 6545 | #ifdef DATAGRAM_SOCKETS |
| 6541 | if (DATAGRAM_CHAN_P (outfd)) | 6546 | if (DATAGRAM_CHAN_P (outfd)) |
| @@ -8257,9 +8262,13 @@ If optional argument QUERY is `current', ignore OMP_NUM_THREADS. | |||
| 8257 | If QUERY is `all', also count processors not available. */) | 8262 | If QUERY is `all', also count processors not available. */) |
| 8258 | (Lisp_Object query) | 8263 | (Lisp_Object query) |
| 8259 | { | 8264 | { |
| 8265 | #ifndef MSDOS | ||
| 8260 | return make_uint (num_processors (EQ (query, Qall) ? NPROC_ALL | 8266 | return make_uint (num_processors (EQ (query, Qall) ? NPROC_ALL |
| 8261 | : EQ (query, Qcurrent) ? NPROC_CURRENT | 8267 | : EQ (query, Qcurrent) ? NPROC_CURRENT |
| 8262 | : NPROC_CURRENT_OVERRIDABLE)); | 8268 | : NPROC_CURRENT_OVERRIDABLE)); |
| 8269 | #else | ||
| 8270 | return make_fixnum (1); | ||
| 8271 | #endif | ||
| 8263 | } | 8272 | } |
| 8264 | 8273 | ||
| 8265 | #ifdef subprocesses | 8274 | #ifdef subprocesses |
| @@ -8304,10 +8313,15 @@ open_channel_for_module (Lisp_Object process) | |||
| 8304 | { | 8313 | { |
| 8305 | CHECK_PROCESS (process); | 8314 | CHECK_PROCESS (process); |
| 8306 | CHECK_TYPE (PIPECONN_P (process), Qpipe_process_p, process); | 8315 | CHECK_TYPE (PIPECONN_P (process), Qpipe_process_p, process); |
| 8316 | #ifndef MSDOS | ||
| 8307 | int fd = dup (XPROCESS (process)->open_fd[SUBPROCESS_STDOUT]); | 8317 | int fd = dup (XPROCESS (process)->open_fd[SUBPROCESS_STDOUT]); |
| 8308 | if (fd == -1) | 8318 | if (fd == -1) |
| 8309 | report_file_error ("Cannot duplicate file descriptor", Qnil); | 8319 | report_file_error ("Cannot duplicate file descriptor", Qnil); |
| 8310 | return fd; | 8320 | return fd; |
| 8321 | #else | ||
| 8322 | /* PIPECONN_P returning true shouldn't be possible on MSDOS. */ | ||
| 8323 | emacs_abort (); | ||
| 8324 | #endif | ||
| 8311 | } | 8325 | } |
| 8312 | 8326 | ||
| 8313 | 8327 | ||