Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: deadlock caused by gettext usage in a signal handler
- X-seq: zsh-workers 24180
- From: Peter Stephenson <pws@xxxxxxx>
- To: "Zsh Hackers' List" <zsh-workers@xxxxxxxxxx>, Guillaume Chazarain <guichaz@xxxxxxxx>
- Subject: Re: deadlock caused by gettext usage in a signal handler
- Date: Fri, 07 Dec 2007 11:29:22 +0000
- In-reply-to: <20071207114631.7fa1eab9@xxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20071130203534.1d1ea29c@xxxxxxxx> <20071204203017.35a29727.p.w.stephenson@xxxxxxxxxxxx> <20071207000207.2eb7e5e7@xxxxxxxx> <20071207103533.47776664@news01> <20071207114631.7fa1eab9@xxxxxxxx>
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@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author