X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frecvfrom.c;h=5edd1d8b1c9df7fe79ad87098f997b1b203fe8d4;hb=1d71dc7c690b5fe61e3e0c06303ffb59434bba4b;hp=a9c0affea5f5b9e95a0d7eb800dd58902c0c79fa;hpb=441aa3044f43e5572f58c354f01e6bc070acd5c7;p=gnulib.git diff --git a/lib/recvfrom.c b/lib/recvfrom.c index a9c0affea..5edd1d8b1 100644 --- a/lib/recvfrom.c +++ b/lib/recvfrom.c @@ -1,6 +1,6 @@ /* recvfrom.c --- wrappers for Windows recvfrom function - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,11 +28,11 @@ #undef recvfrom -int -rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, - int *fromlen) +ssize_t +rpl_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, + socklen_t *fromlen) { - int frombufsize = *fromlen; + int frombufsize = (from != NULL ? *fromlen : 0); SOCKET sock = FD_TO_SOCKET (fd); int r = recvfrom (sock, buf, len, flags, from, fromlen); @@ -41,7 +41,7 @@ rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from, /* Winsock recvfrom() only returns a valid 'from' when the socket is connectionless. POSIX gives a valid 'from' for all types of sockets. */ - else if (*fromlen == frombufsize) + else if (from != NULL && *fromlen == frombufsize) rpl_getpeername (fd, from, fromlen); return r;