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

* Re: [patch] emacsclient vs SIGWINCH
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2011-02-18 21:24 UTC (permalink / raw)
  To: Karl Chen; +Cc: emacs-devel

    On Solaris (but not Linux), emacsclient dies upon SIGWINCH.

Thanks for fixing a bug, but you really should not call our system
"Linux".

Solaris is an operating system, and you can run Emacs on it.  Linux is
not an operating system, and you can't run Emacs on it.  If you are
thinking of something that is a sufficient platform to run Emacs, you
must have in mind the GNU/Linux system.

To call the GNU/Linux system "Linux" is giving the credit for our work
to someone else who did less.  Now that you know, please make an
effort to treat us fairly.

See http://www.gnu.org/gnu/gnu-linux-faq.html.

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org, www.gnu.org



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

* Re: [patch] emacsclient vs SIGWINCH
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2011-02-18 22:28 UTC (permalink / raw)
  To: Karl Chen; +Cc: 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.

Thanks, installed.


        Stefan



^ permalink raw reply	[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).