1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-21 00:01:26 +01:00

24179: use queue_signals() for 24170

24180: back off strerror_r() patch, except for use of temporary var
This commit is contained in:
Peter Stephenson 2007-12-07 11:34:47 +00:00
parent f9bf1dc558
commit cefc0d927f
4 changed files with 7 additions and 32 deletions

View file

@ -1,5 +1,9 @@
2007-12-07 Peter Stephenson <pws@csr.com>
* 24180: configure.ac, Src/utils.c: back off (most of) 24148.
* 24179: Src/exec.c: alter 241770 to use queue_signals().
* Guillaume Chazarain: 24170: Src/exec.c: block interrupts
around fork since it may mess with locks.

View file

@ -229,7 +229,6 @@ zfork(struct timeval *tv)
{
pid_t pid;
struct timezone dummy_tz;
sigset_t signals;
/*
* Is anybody willing to explain this test?
@ -240,10 +239,9 @@ zfork(struct timeval *tv)
}
if (tv)
gettimeofday(tv, &dummy_tz);
sigfillset(&signals);
signals = signal_block(signals);
queue_signals();
pid = fork();
signal_setmask(signals);
unqueue_signals();
if (pid == -1) {
zerr("fork failed: %e", errno);
return -1;

View file

@ -310,34 +310,7 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
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)

View file

@ -1157,7 +1157,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
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 \