zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "Zsh Hackers' List" <zsh-workers@sunsite.dk>,
	Guillaume Chazarain <guichaz@yahoo.fr>
Subject: Re: deadlock caused by gettext usage in a signal handler
Date: Fri, 07 Dec 2007 11:29:22 +0000	[thread overview]
Message-ID: <200712071129.lB7BTMoH012749@news01.csr.com> (raw)
In-Reply-To: <20071207114631.7fa1eab9@inria.fr>

Guillaume Chazarain wrote:
> Thanks, how about reverting the strerror_r one (also in zsh-4.2)?

That's probably neater, given the hack to get it to work.  However, it's
marginally neater to keep the errmsg variable.  It makes it look like
I've done something.

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.85
diff -u -r1.85 configure.ac
--- configure.ac	7 Dec 2007 02:53:17 -0000	1.85
+++ configure.ac	7 Dec 2007 11:25:52 -0000
@@ -1157,7 +1157,7 @@
 	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
 	       initgroups nis_list \
 	       setuid seteuid setreuid setresuid setsid \
-	       memcpy memmove strstr strerror strerror_r \
+	       memcpy memmove strstr strerror \
 	       getrlimit getrusage \
 	       setlocale \
 	       uname \
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.172
diff -u -r1.172 utils.c
--- Src/utils.c	3 Dec 2007 22:46:11 -0000	1.172
+++ Src/utils.c	7 Dec 2007 11:26:01 -0000
@@ -310,34 +310,7 @@
 		    errflag = 1;
 		    return;
 		}
-#ifdef HAVE_STRERROR_R
-		/*
-		 * There are two incompatible strerror_r()s floating round.
-		 * The GNU extension refuses to copy the message into the
-		 * buffer if it can return a constant string.  To suppress it
-		 * we need to define _XOPEN_SOURCE to 600.  I don't dare do
-		 * this because we're already depending on _GNU_SOURCE.  So
-		 * try to handle both by looking for errno being set (for the
-		 * standard version failing) or errbuf being left untouched
-		 * (for the GNU version).  One presumes that if strerror_r()
-		 * didn't copy anything to errbuf, then it's safe to
-		 * call strerror() to get the string.
-		 *
-		 * This is a mess, but it's about a decade and half
-		 * too late to shirk from messes in the source.
-		 */
-		olderrno = errno;
-		errno = 0;
-		errbuf[0] = '\0';
-		strerror_r(num, errbuf, ERRBUFSIZE);
-		if (errno || errbuf[0] == '\0')
-		    errmsg = strerror(num);
-		else
-		    errmsg = errbuf;
-		errno = olderrno;
-#else
 		errmsg = strerror(num);
-#endif
 		/* If the message is not about I/O problems, it looks better *
 		 * if we uncapitalize the first letter of the message        */
 		if (num == EIO)


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


  parent reply	other threads:[~2007-12-07 11:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 19:35 Guillaume Chazarain
2007-12-03 22:43 ` Peter Stephenson
2007-12-04  1:39   ` Paul Ackersviller
2007-12-04 18:02   ` Guillaume Chazarain
2007-12-04 18:24     ` Peter Stephenson
2007-12-04 18:43       ` Guillaume Chazarain
2007-12-04 19:43         ` Peter Stephenson
2007-12-04 19:49           ` Guillaume Chazarain
2007-12-04 20:30 ` Peter Stephenson
2007-12-04 23:09   ` Guillaume Chazarain
2007-12-06 23:02   ` Guillaume Chazarain
2007-12-07 10:35     ` Peter Stephenson
2007-12-07 10:46       ` Guillaume Chazarain
2007-12-07 11:21         ` Bart Schaefer
2007-12-07 11:27           ` Peter Stephenson
2007-12-07 11:57             ` Guillaume Chazarain
2007-12-07 11:29         ` Peter Stephenson [this message]
2007-12-10  0:11 Paul Ackersviller
2007-12-10  2:04 ` Bart Schaefer
2007-12-10  3:17   ` Paul Ackersviller

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=200712071129.lB7BTMoH012749@news01.csr.com \
    --to=pws@csr.com \
    --cc=guichaz@yahoo.fr \
    --cc=zsh-workers@sunsite.dk \
    /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 public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).