openbsd-ports/editors/emacs23/patches/patch-src_minibuf_c
jasper e1e5959988 import emacs 23.3
joint work with, and ok dcoppa@ mikeb@ sthen@, as well as Manuel Giraud
2011-03-28 15:18:54 +00:00

45 lines
1.2 KiB
Plaintext

$OpenBSD: patch-src_minibuf_c,v 1.1.1.1 2011/03/28 15:18:56 jasper Exp $
'emacs --batch -f byte-compile-file' fails after inactivity timer
fires up. the solution is to restart fgets upon receiving EINTR.
afaik, read_minibuf_noninteractive is called only in the batch
mode
--- src/minibuf.c.orig Sat Jan 8 18:45:14 2011
+++ src/minibuf.c Wed Mar 23 20:56:39 2011
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org
#include <config.h>
+#include <errno.h>
#include <stdio.h>
#include <setjmp.h>
@@ -306,12 +307,21 @@ read_minibuf_noninteractive (map, initial, prompt, bac
size = 100;
len = 0;
line = (char *) xmalloc (size * sizeof *line);
- while ((s = fgets (line + len, size - len, stdin)) != NULL
- && (len = strlen (line),
- len == size - 1 && line[len - 1] != '\n'))
+
+again:
+ if ((s = fgets (line + len, size - len, stdin)) != NULL)
{
- size *= 2;
- line = (char *) xrealloc (line, size);
+ len = strlen (line);
+ if (len > 0 && line[len - 1] != '\n')
+ {
+ size *= 2;
+ line = (char *) xrealloc (line, size);
+ goto again;
+ }
+ }
+ else if (errno == EINTR)
+ {
+ goto again;
}
if (s)