This is the mail archive of the cygwin-developers@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

wait not setting errno to EINTR when interrupted



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]