diff options
author | Jeremy Allison <jra@samba.org> | 2001-06-27 17:26:29 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-06-27 17:26:29 +0000 |
commit | 8f91108faf42fbaedd7ed8bbfb107f216fee1bbe (patch) | |
tree | dfc9cb38b29dbf4acf120d8c0bdb3f12b9e9aa83 /source3 | |
parent | dc346a5c6d6b071a67397150f72a530515b5cf53 (diff) | |
download | samba-8f91108faf42fbaedd7ed8bbfb107f216fee1bbe.tar.gz samba-8f91108faf42fbaedd7ed8bbfb107f216fee1bbe.tar.bz2 samba-8f91108faf42fbaedd7ed8bbfb107f216fee1bbe.zip |
Syncup between 2.2 and HEAD.
Jeremy.
(This used to be commit 39d4131a4571c9c7a96bdc2f6cd6be80a6c330af)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/util_sock.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index e3673f011a..ccbc86bb0b 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -174,26 +174,25 @@ void set_socket_options(int fd, char *options) ssize_t read_udp_socket(int fd,char *buf,size_t len) { - ssize_t ret; - struct sockaddr_in sock; - int socklen; - - socklen = sizeof(sock); - memset((char *)&sock,'\0',socklen); - memset((char *)&lastip,'\0',sizeof(lastip)); - ret = (ssize_t)recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen); - if (ret <= 0) { - DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno))); - return(0); - } + ssize_t ret; + struct sockaddr_in sock; + socklen_t socklen = sizeof(sock); - lastip = sock.sin_addr; - lastport = ntohs(sock.sin_port); + memset((char *)&sock,'\0',socklen); + memset((char *)&lastip,'\0',sizeof(lastip)); + ret = (ssize_t)recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen); + if (ret <= 0) { + DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno))); + return(0); + } - DEBUG(10,("read_udp_socket: lastip %s lastport %d read: %d\n", - inet_ntoa(lastip), lastport, ret)); + lastip = sock.sin_addr; + lastport = ntohs(sock.sin_port); - return(ret); + DEBUG(10,("read_udp_socket: lastip %s lastport %d read: %d\n", + inet_ntoa(lastip), lastport, ret)); + + return(ret); } /**************************************************************************** |