some bug fixes

Fifer, Eric EFifer@sanwaint.com
Mon Mar 13 07:43:00 GMT 2000


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin.pipe.patch
Type: text/x-diff
Size: 2730 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-developers/attachments/20000313/e262fbb3/attachment.bin>


More information about the Cygwin-developers mailing list