From: Karl Chen <Karl.Chen@quarl.org>
To: Emacs Developement List <emacs-devel@gnu.org>
Subject: [patch] emacsclient vs SIGWINCH
Date: Thu, 17 Feb 2011 15:10:41 -0500 [thread overview]
Message-ID: <quack.20110217T1510.87y65e5sn2@honk.quarl.org> (raw)
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;
next reply other threads:[~2011-02-17 20:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 20:10 Karl Chen [this message]
2011-02-18 21:24 ` [patch] emacsclient vs SIGWINCH Richard Stallman
2011-02-18 22:28 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=quack.20110217T1510.87y65e5sn2@honk.quarl.org \
--to=karl.chen@quarl.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.