emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-30 5cf64d8377a: Fix sporadic crashes and `select' failures in dump


From: Po Lu
Subject: emacs-30 5cf64d8377a: Fix sporadic crashes and `select' failures in dumped images
Date: Sun, 28 Jul 2024 22:37:42 -0400 (EDT)

branch: emacs-30
commit 5cf64d8377ad43f9a7b0ad28cbb4a494b403806b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/process.c | 26 +++++++++++++++++---------
 1 file 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);
 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;
@@ -5350,7 +5350,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
        struct Lisp_Process *p;
 
        retry_for_async = false;
-       FOR_EACH_PROCESS(process_list_head, aproc)
+       FOR_EACH_PROCESS (process_list_head, aproc)
          {
            p = XPROCESS (aproc);
 
@@ -5706,9 +5706,9 @@ 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
-                  && FD_ISSET (wait_proc->infd, &tls_available))))
+             && (!wait_proc
+                 || (wait_proc->infd >= 0
+                     && FD_ISSET (wait_proc->infd, &tls_available))))
            timeout = make_timespec (0, 0);
 #endif
 
@@ -5769,8 +5769,8 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                /* Slow path, merge one by one.  Note: nfds does not need
                   to be accurate, just positive is enough. */
                for (channel = 0; channel < FD_SETSIZE; ++channel)
-                 if (FD_ISSET(channel, &tls_available))
-                   FD_SET(channel, &Available);
+                 if (FD_ISSET (channel, &tls_available))
+                   FD_SET (channel, &Available);
            }
 #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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]