This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: 64bit: segfault : recv return type ?
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-apps at cygwin dot com
- Date: Mon, 8 Apr 2013 10:00:18 +0200
- Subject: Re: 64bit: segfault : recv return type ?
- References: <5159A39B dot 6020102 at gmail dot com> <20130402085923 dot GA7108 at calimero dot vinschen dot de> <515C2F00 dot 1000401 at gmail dot com> <20130403142202 dot GF31598 at calimero dot vinschen dot de> <51607B09 dot 2010103 at gmail dot com> <20130406211049 dot GA30677 at calimero dot vinschen dot de> <51611ADD dot 5060701 at gmail dot com> <5161A911 dot 4030507 at gmail dot com>
- Reply-to: cygwin-apps at cygwin dot com
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.
Thank you,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat