Bug#742965: libc0.1: openpty()/forkpty() fail on kfreebsd >=9.0
Package: libc0.1
Version: 2.18-4
Severity: normal
If a process has a handler for SIGCHLD, openpty() fails on kfreebsd with 9.x
kernels. It worked ok on 8.x, and works on "real" (ie, no glibc) FreeBSD.
A reduced test case attached; when commenting out the sigaction line,
openpty() starts working again.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: kfreebsd-amd64 (x86_64)
Kernel: kFreeBSD 9.2-1-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libc0.1 depends on:
ii libgcc1 1:4.8.2-16
libc0.1 recommends no packages.
Versions of packages libc0.1 suggests:
ii debconf [debconf-2.0] 1.5.52
pn glibc-doc <none>
ii locales 2.18-4
-- debconf information:
glibc/upgrade: true
glibc/disable-screensaver:
glibc/restart-services:
glibc/restart-failed:
libraries/restart-without-asking: false
// Link with -lutil
#include <stdio.h>
#include <pty.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
static void sigchild(int dummy)
{
while (waitpid(-1,0,WNOHANG)>0);
}
int main()
{
int master, slave;
struct sigaction act;
sigemptyset(&act.sa_mask);
act.sa_flags=SA_RESTART;
act.sa_handler=sigchild;
sigaction(SIGCHLD,&act,0);
if (openpty(&master, &slave, 0, 0, 0))
{
printf("Failed: %s\n", strerror(errno));
return 1;
}
printf("Ok!\n");
return 0;
}
Reply to: