Don't retry reading after receiving EINVAL
authorPip Cet <pipcet@gmail.com>
Mon, 14 Sep 2020 13:18:52 +0000 (15:18 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 14 Sep 2020 13:18:52 +0000 (15:18 +0200)
* src/process.c (wait_reading_process_output): Don't retry reading
from an fd after an unknown error (bug#6074).

src/process.c

index 3aa105ae342c720d36852cc9a42e655b0350889f..53f4a1d8530a6a923fb055f27d431a5e6aa8ec04 100644 (file)
@@ -5413,14 +5413,16 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
          /* If data can be read from the process, do so until exhausted.  */
          if (wait_proc->infd >= 0)
            {
+             unsigned int count = 0;
              XSETPROCESS (proc, wait_proc);
 
              while (true)
                {
                  int nread = read_process_output (proc, wait_proc->infd);
+                 rarely_quit (++count);
                  if (nread < 0)
                    {
-                     if (errno == EIO || would_block (errno))
+                     if (errno != EINTR)
                        break;
                    }
                  else