Post by Dan NicolaescuHi,
After the latest round of patches "emacsclient -t" crashes after a
suspend(C-z) followed by a resume (fg %emacsclient)
There are 2 problems in emacsclient. One is that the "in" and "out"
FILE* are not initialized anymore. The other is a typo in handling
commands.
Please apply this patch:
--- emacsclient.c~ 2006-12-13 02:17:07.356752000 -0800
+++ emacsclient.c 2006-12-13 01:57:57.866389000 -0800
@@ -1173,6 +1173,26 @@
if ((s = set_socket ()) == INVALID_SOCKET)
fail ();
+ /* We use the stream OUT to send our commands to the server. */
+ if ((out = fdopen (s, "r+")) == NULL)
+ {
+ fprintf (stderr, "%s: ", argv[0]);
+ perror ("fdopen");
+ fail ();
+ }
+
+ /* We use the stream IN to read the responses.
+ We used to use just one stream for both output and input
+ on the socket, but reversing direction works nonportably:
+ on some systems, the output appears as the first input;
+ on other systems it does not. */
+ if ((in = fdopen (s, "r+")) == NULL)
+ {
+ fprintf (stderr, "%s: ", argv[0]);
+ perror ("fdopen");
+ fail ();
+ }
+
cwd = get_current_dir_name ();
if (cwd == 0)
@@ -1400,7 +1420,7 @@
fprintf (stderr, "*ERROR*: %s", str);
needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
}
- else if (strprefix ("-suspend ", str))
+ else if (strprefix ("-suspend ", string))
{
/* -suspend: Suspend this terminal, i.e., stop the process. */
if (needlf)