Snapshot uploaded, please try

Brian Ford Brian.Ford@flightsafety.com
Thu Aug 17 23:49:00 GMT 2006


On Thu, 17 Aug 2006, Brian Ford wrote:
> Attached is a simpler C test case distilled from the make code causing
> the problem.

Probably obvious, but simpler yet.

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...
.

-------------- next part --------------
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>

int
main(void)
{
    int fds[2], flags;

    /* Make a file descriptor that is the read end of a broken pipe.
       This will be used for the child's standard input. */

    if (pipe(fds) < 0)
    {
	perror("pipe");
	return -1;
    }

    /* Close the write side. */
    close (fds[1]);

    /* Set close on exec, so it does not litter the child's descriptor table.
       When it is dup2'd onto descriptor 0, that descriptor will not close
       on exec. */

    flags = fcntl(fds[0], F_GETFD, 0);

    if (flags < 0 || fcntl(fds[0], F_SETFD, flags|FD_CLOEXEC) < 0)
    {
	perror("close on exec");
	return -1;
    }

    return 0;
}
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list