diff options
| author | Po Lu | 2024-07-29 10:37:16 +0800 |
|---|---|---|
| committer | Po Lu | 2024-07-29 10:37:16 +0800 |
| commit | 5cf64d8377ad43f9a7b0ad28cbb4a494b403806b (patch) | |
| tree | 5128e0b6e5639e984415d8aac15e2f78b2076dcd /src/process.c | |
| parent | a475360af980673fe97a701633375c3a308364c6 (diff) | |
| download | emacs-5cf64d8377ad43f9a7b0ad28cbb4a494b403806b.tar.gz emacs-5cf64d8377ad43f9a7b0ad28cbb4a494b403806b.zip | |
Fix sporadic crashes and `select' failures in dumped images
* src/process.c (init_process_emacs) [HAVE_UNEXEC]: Clear
dumped values of child_signal_read_fd and child_signal_write_fd.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/process.c b/src/process.c index 0167ceff7e0..9b44603c047 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -275,9 +275,9 @@ static int read_process_output (Lisp_Object, int); | |||
| 275 | static void create_pty (Lisp_Object); | 275 | static void create_pty (Lisp_Object); |
| 276 | static void exec_sentinel (Lisp_Object, Lisp_Object); | 276 | static void exec_sentinel (Lisp_Object, Lisp_Object); |
| 277 | 277 | ||
| 278 | static Lisp_Object | 278 | static Lisp_Object network_lookup_address_info_1 (Lisp_Object, const char *, |
| 279 | network_lookup_address_info_1 (Lisp_Object host, const char *service, | 279 | struct addrinfo *, |
| 280 | struct addrinfo *hints, struct addrinfo **res); | 280 | struct addrinfo **); |
| 281 | 281 | ||
| 282 | /* Number of bits set in connect_wait_mask. */ | 282 | /* Number of bits set in connect_wait_mask. */ |
| 283 | static int num_pending_connects; | 283 | static int num_pending_connects; |
| @@ -5350,7 +5350,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5350 | struct Lisp_Process *p; | 5350 | struct Lisp_Process *p; |
| 5351 | 5351 | ||
| 5352 | retry_for_async = false; | 5352 | retry_for_async = false; |
| 5353 | FOR_EACH_PROCESS(process_list_head, aproc) | 5353 | FOR_EACH_PROCESS (process_list_head, aproc) |
| 5354 | { | 5354 | { |
| 5355 | p = XPROCESS (aproc); | 5355 | p = XPROCESS (aproc); |
| 5356 | 5356 | ||
| @@ -5706,9 +5706,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5706 | /* If wait_proc is somebody else, we have to wait in select | 5706 | /* If wait_proc is somebody else, we have to wait in select |
| 5707 | as usual. Otherwise, clobber the timeout. */ | 5707 | as usual. Otherwise, clobber the timeout. */ |
| 5708 | if (tls_nfds > 0 | 5708 | if (tls_nfds > 0 |
| 5709 | && (!wait_proc || | 5709 | && (!wait_proc |
| 5710 | (wait_proc->infd >= 0 | 5710 | || (wait_proc->infd >= 0 |
| 5711 | && FD_ISSET (wait_proc->infd, &tls_available)))) | 5711 | && FD_ISSET (wait_proc->infd, &tls_available)))) |
| 5712 | timeout = make_timespec (0, 0); | 5712 | timeout = make_timespec (0, 0); |
| 5713 | #endif | 5713 | #endif |
| 5714 | 5714 | ||
| @@ -5769,8 +5769,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 5769 | /* Slow path, merge one by one. Note: nfds does not need | 5769 | /* Slow path, merge one by one. Note: nfds does not need |
| 5770 | to be accurate, just positive is enough. */ | 5770 | to be accurate, just positive is enough. */ |
| 5771 | for (channel = 0; channel < FD_SETSIZE; ++channel) | 5771 | for (channel = 0; channel < FD_SETSIZE; ++channel) |
| 5772 | if (FD_ISSET(channel, &tls_available)) | 5772 | if (FD_ISSET (channel, &tls_available)) |
| 5773 | FD_SET(channel, &Available); | 5773 | FD_SET (channel, &Available); |
| 5774 | } | 5774 | } |
| 5775 | #endif | 5775 | #endif |
| 5776 | } | 5776 | } |
| @@ -8616,6 +8616,14 @@ init_process_emacs (int sockfd) | |||
| 8616 | 8616 | ||
| 8617 | inhibit_sentinels = 0; | 8617 | inhibit_sentinels = 0; |
| 8618 | 8618 | ||
| 8619 | #ifdef HAVE_UNEXEC | ||
| 8620 | /* Clear child_signal_read_fd and child_signal_write_fd after dumping, | ||
| 8621 | lest wait_reading_process_output should select on nonexistent file | ||
| 8622 | descriptors which existed in the build process. */ | ||
| 8623 | child_signal_read_fd = -1; | ||
| 8624 | child_signal_write_fd = -1; | ||
| 8625 | #endif /* HAVE_UNEXEC */ | ||
| 8626 | |||
| 8619 | if (!will_dump_with_unexec_p ()) | 8627 | if (!will_dump_with_unexec_p ()) |
| 8620 | { | 8628 | { |
| 8621 | #if defined HAVE_GLIB && !defined WINDOWSNT | 8629 | #if defined HAVE_GLIB && !defined WINDOWSNT |