Patch: socket protocol parameter not handled correctly.

Corinna Vinschen cygwin-patches@cygwin.com
Sat Mar 17 09:15:00 GMT 2001


On Sat, Mar 17, 2001 at 06:05:12PM +0100, Corinna Vinschen wrote:
> On Sat, Mar 17, 2001 at 10:15:50AM -0500, Mathew Brozowski wrote:
> > I have been recently working on a port or a ping program to cygwin.  After I
> > got past the header problems (which I hope to send a separate patch for
> > soon) and got everything building it still wasn't working.  I used tcpdump
> > on a linux machine and found that the packets being sent were not encoded
> > with the ICMP protocol identifier but with the identifier 0.  I tracked it
> > down to the fact that the cygwin_socket routine wasn't passing the protocol
> > parameter to the Windows socket call.  After fixing this rebuilding the
> > cygwin1.dll the ping program worked great!  Here's the patch minor though it
> > is.
> > 
> > Matt Brozowski
> > 
> > Sat Mar 17 09:51:32 2001 Mathew Brozowski <brozow@tavve.com>
> > 
> >  * net.cc (cygwin_socket): Pass protocol parameter to socket call.
> > 
> > --- net.cc-orig Sat Mar 17 09:46:08 2001
> > +++ net.cc Sat Mar 17 09:49:10 2001
> > @@ -352,7 +352,7 @@ cygwin_socket (int af, int type, int pro
> >      {
> >        debug_printf ("socket (%d, %d, %d)", af, type, protocol);
> > 
> > -      soc = socket (AF_INET, type, 0);
> > +      soc = socket (AF_INET, type, protocol);

Grand maleur. I had to change that to

+      soc = socket (AF_INET, type, AF_UNIX ? 0 : protocol);

to avoid a WSAEPROTONOSUPPORT error when address family was set
to AF_UNIX/AF_LOCAL.

Thanks anyway,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-patches mailing list