This is the mail archive of the cygwin-apps 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]
Other format: [Raw text]

Re: 64bit: segfault : recv return type ?


On Apr  8 10:00, Corinna Vinschen wrote:
> On Apr  7 19:12, marco atzeri wrote:
> > On 4/7/2013 9:06 AM, marco atzeri wrote:
> > >On 4/6/2013 11:10 PM, Corinna Vinschen wrote:
> > 
> > >>What is the original code doing?
> > >>
> > >>
> > >>Corinna
> > >>
> > 
> > 
> > I think the problem in on recv definition.
> > [...]
> > recv 4294967295
> > before for n  4294967295
> > [MARCOATZERI:03904] *** Process received signal ***
> > [MARCOATZERI:03904] Signal: Segmentation fault (11)
> > -----------------------------------------------------
> > 
> > so recv is returning 2^32-1 instead of the expected -1
> > 
> > 
> > on winsup/cygwin/net.cc is defined as function returning int
> > -------------------------------------------------------
> > /* exported as recv: standards? */
> > extern "C" int
> > cygwin_recv (int fd, void *buf, size_t len, int flags)
> > {
> >   int res;
> > 
> >   fhandler_socket *fh = get (fd);
> > 
> >   myfault efault;
> >   if (efault.faulted (EFAULT) || !fh)
> >     res = -1;
> > -------------------------------------------------------
> > 
> > while on sys/socket.h
> >     ssize_t recv (int, void *__buff, size_t __len, int __flags);
> > 
> > on POSIX
> >   http://pubs.opengroup.org/onlinepubs/009695399/functions/recv.html
> > 
> > (and also
> >    newlib/libc/sys/linux/net/recv.c return ssize_t)
> > 
> > while:
> > sizeof(int) = 4
> > sizeof(ssize_t) = 8
> 
> You're oh so right.  Thanks for tracking this down.  I'll fix that asap.

Should be fixed in CVS.  I'll create a new 64 bit Cygwin DLL later today.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat


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