unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [patch] emacsclient vs SIGWINCH
@ 2011-02-17 20:10 Karl Chen
  2011-02-18 21:24 ` Richard Stallman
  2011-02-18 22:28 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Karl Chen @ 2011-02-17 20:10 UTC (permalink / raw)
  To: Emacs Developement List


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;



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-18 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-17 20:10 [patch] emacsclient vs SIGWINCH Karl Chen
2011-02-18 21:24 ` Richard Stallman
2011-02-18 22:28 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).