From: Ian Jackson Date: Sun, 22 Jan 2017 11:55:31 +0000 (+0000) Subject: Merge from sid [dgit] X-Git-Tag: debian/2.1.2~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=authbind.git;a=commitdiff_plain;h=9d4eb04ba356aac58d96bbb2bdf81bd69ba68122;hp=5ea5146c77528ffca1aa188ef2d62a4ba7f0c721 Merge from sid [dgit] --- diff --git a/debian/changelog b/debian/changelog index 531fbbd..57e2e09 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +authbind (2.1.2) unstable; urgency=low + + * Cope with programs which set SIGCHLD to SIG_IGN. (We assume + they don't manipulate SIGCHLD on other threads, which is probably + true.) Patch from Marco d'Itri, slightly modified. Closes:#765587. + * Fix one-letter typo in previous changelog entry. + + -- + authbind (2.1.1+nmu1) unstable; urgency=medium * Non-maintainer upload. @@ -14,7 +23,7 @@ authbind (2.1.1) unstable; urgency=low library and package version numbers are not the same, so this is misleading, and we do not want to introduce new machinery just to plumb the package version number through. Closes: #676440. - * Another minor wording fix in the manpage.x + * Another minor wording fix in the manpage. -- Ian Jackson Sun, 10 Jun 2012 23:17:14 +0100 diff --git a/libauthbind.c b/libauthbind.c index a685ce3..42630e4 100644 --- a/libauthbind.c +++ b/libauthbind.c @@ -146,9 +146,10 @@ int bind(int fd, const struct sockaddr *addr, socklen_t addrlen) { pid_t child, rchild; char portarg[5], addrarg[33]; const char *afarg; - int i, r, status; + int i, r, status, restore_sigchild; const int *evilsignal; sigset_t block, saved; + struct sigaction old_sigchild; unsigned int portval; switch (addr->sa_family) { @@ -195,6 +196,18 @@ int bind(int fd, const struct sockaddr *addr, socklen_t addrlen) { sprintf(portarg,"%04x", portval&0x0ffff); + restore_sigchild= 0; + if (sigaction(SIGCHLD,NULL,&old_sigchild)) return -1; + if (old_sigchild.sa_handler == SIG_IGN) { + struct sigaction new_sigchild; + + new_sigchild.sa_handler= SIG_DFL; + sigemptyset(&new_sigchild.sa_mask); + new_sigchild.sa_flags= 0; + if (sigaction(SIGCHLD,&new_sigchild,&old_sigchild)) return -1; + restore_sigchild= 1; + } + child= fork(); if (child==-1) goto x_err; if (!child) { @@ -228,5 +241,13 @@ x_err: r= -1; x: if (sigprocmask(SIG_SETMASK,&saved,0)) abort(); + if (restore_sigchild) { + if (sigaction(SIGCHLD,&old_sigchild,NULL)) return -1; + if (old_sigchild.sa_handler == SIG_IGN) { + int discard; + while (waitpid(-1, &discard, WNOHANG) > 0) + ; + } + } return r; }