1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 06:50:23 -08:00

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.
This commit is contained in:
Po Lu 2024-07-29 10:37:16 +08:00
parent a475360af9
commit 5cf64d8377

View file

@ -275,9 +275,9 @@ static int read_process_output (Lisp_Object, int);
static void create_pty (Lisp_Object);
static void exec_sentinel (Lisp_Object, Lisp_Object);
static Lisp_Object
network_lookup_address_info_1 (Lisp_Object host, const char *service,
struct addrinfo *hints, struct addrinfo **res);
static Lisp_Object network_lookup_address_info_1 (Lisp_Object, const char *,
struct addrinfo *,
struct addrinfo **);
/* Number of bits set in connect_wait_mask. */
static int num_pending_connects;
@ -5706,8 +5706,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
/* If wait_proc is somebody else, we have to wait in select
as usual. Otherwise, clobber the timeout. */
if (tls_nfds > 0
&& (!wait_proc ||
(wait_proc->infd >= 0
&& (!wait_proc
|| (wait_proc->infd >= 0
&& FD_ISSET (wait_proc->infd, &tls_available))))
timeout = make_timespec (0, 0);
#endif
@ -8616,6 +8616,14 @@ init_process_emacs (int sockfd)
inhibit_sentinels = 0;
#ifdef HAVE_UNEXEC
/* Clear child_signal_read_fd and child_signal_write_fd after dumping,
lest wait_reading_process_output should select on nonexistent file
descriptors which existed in the build process. */
child_signal_read_fd = -1;
child_signal_write_fd = -1;
#endif /* HAVE_UNEXEC */
if (!will_dump_with_unexec_p ())
{
#if defined HAVE_GLIB && !defined WINDOWSNT