This is the mail archive of the
cygwin-developers@sourceware.cygnus.com
mailing list for the Cygwin project.
wait not setting errno to EINTR when interrupted
- To: "'cygwin-developers at sourceware dot cygnus dot com'" <cygwin-developers at sourceware dot cygnus dot com>
- Subject: wait not setting errno to EINTR when interrupted
- From: "Fifer, Eric" <EFifer at sanwaint dot com>
- Date: Mon, 28 Feb 2000 15:59:19 -0000
With the Feb-27 I'm seeing a interrupted wait() not setting errno to EINTR.
This is an example:
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
int onalrm() { printf("onalrm\n"); }
main()
{
pid_t pid;
int status = 0;
if(fork() == 0) {
sleep(10);
exit(37);
}
signal(SIGALRM, onalrm);
alarm(3);
pid = wait(&status);
printf("pid=%d status=%d errno=%d\n", pid, status, errno);
}
A run shows:
% ./a.exe
onalrm
pid=-1 status=0 errno=10
errno should be 4 (EINTR), *not* 10 (ECHILD, No Children).
I've attached a fix that works, but I'm not certain it is correct.
Eric
wait.patch