[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patch] emacsclient vs SIGWINCH
From: |
Karl Chen |
Subject: |
[patch] emacsclient vs SIGWINCH |
Date: |
Thu, 17 Feb 2011 15:10:41 -0500 |
On Solaris (but not Linux), emacsclient dies upon SIGWINCH.
The problem is that recv() gets interrupted and returns EINTR.
The patch below works for me.
Karl
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index e5484b9..17945aa 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1708,10 +1708,21 @@ main (int argc, char **argv)
fsync (1);
/* Now, wait for an answer and print any messages. */
- while (exit_status == EXIT_SUCCESS
- && (rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0)
+ while (exit_status == EXIT_SUCCESS)
{
char *p;
+ do
+ {
+ errno = 0;
+ rl = recv (emacs_socket, string, BUFSIZ, 0);
+ /* If we receive a signal (e.g. SIGWINCH, which we
+ pass through to emacs), on some OSes we get EINTR and
+ must retry. */
+ }
+ while (rl < 0 && errno == EINTR);
+ if (rl <= 0)
+ break;
+
string[rl] = '\0';
p = string + strlen (string) - 1;
- [patch] emacsclient vs SIGWINCH,
Karl Chen <=