Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: deadlock caused by gettext usage in a signal handler



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