From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: [patch] emacsclient vs SIGWINCH Date: Thu, 17 Feb 2011 15:10:41 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1297973361 22293 80.91.229.12 (17 Feb 2011 20:09:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Feb 2011 20:09:21 +0000 (UTC) To: Emacs Developement List Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 17 21:09:16 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PqAA7-0002Uu-Up for ged-emacs-devel@m.gmane.org; Thu, 17 Feb 2011 21:09:16 +0100 Original-Received: from localhost ([127.0.0.1]:42549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqAA7-0007sg-9V for ged-emacs-devel@m.gmane.org; Thu, 17 Feb 2011 15:09:15 -0500 Original-Received: from [140.186.70.92] (port=46608 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqA9y-0007py-Q4 for emacs-devel@gnu.org; Thu, 17 Feb 2011 15:09:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqA9w-0004Lc-Sj for emacs-devel@gnu.org; Thu, 17 Feb 2011 15:09:06 -0500 Original-Received: from honk.quarl.org ([173.45.230.109]:55793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqA9w-0004Kp-Pj for emacs-devel@gnu.org; Thu, 17 Feb 2011 15:09:04 -0500 Original-Received: by honk.quarl.org (Postfix, from userid 1000) id 8819B74332; Thu, 17 Feb 2011 15:10:41 -0500 (EST) X-Hashcash: 1:20:110217:emacs-devel@gnu.org::dDPo+15Mi4KSAvAT:0000000000000000000000000000000000000000003eHh X-Quack-Archive: 1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 173.45.230.109 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136146 Archived-At: 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;