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]

RE: some bug fixes



This is an old thread, but I'd like to try again to get
a minor bug fixed.  I changed the patch so that it doesn't
need to use strcmp on fh->get_name().

With the attached patch, in select.cc (peek_pipe) PeekNamedPipe
should not be called on FH_PIPEW (the write end of a pipe) because
it will fail incorrectly (PeekNamedPipe fails with ACCESS_DENIED
on a handle with only GENERIC_WRITE access).  The remainder of
the patch changes the generic use of FH_PIPE to FH_PIPER and
FH_PIPEW.

This is an example that demonstrates the bug:

#include <sys/select.h>

main()
{
    int fd[2];
    fd_set fde;
    int n;
    struct timeval timeout;

    pipe(fd); /* 0 read, 1 write */
    FD_ZERO(&fde);
    FD_SET(fd[1], &fde);
    timeout.tv_sec = 1; timeout.tv_usec = 0;

    n = select(16, NULL, NULL, &fde, &timeout);
    printf("n = %d\n", n);
}

Thanks.

Eric Fifer

cygwin.pipe.patch


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