9
0
Fork 0

Fix accept() -- it wanted parts of return address initialized

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2008 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2009-08-02 16:31:50 +00:00
parent 68994faba7
commit d0e7e21e63
3 changed files with 21 additions and 8 deletions

View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated June 26, 2009)
NuttX TODO List (Last updated August 3, 2009)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(5) Task/Scheduler (sched/)
@ -234,6 +234,11 @@ o Network (net/, netutils/)
Status: Open, depends on UDP read-ahead support
Priority: Medium
Description: sockets do not support any modes except for O_NONBLOCK (that
that is not implemented in a very general way at present)
Status: Open
Priority: Low.
o USB (drivers/usbdev)
^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/accept.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -102,10 +102,17 @@ struct accept_s
#ifdef CONFIG_NET_IPv6
static inline void accept_tcpsender(FAR struct uip_conn *conn,
FAR struct sockaddr_in6 *addr)
{
if (addr)
{
addr->sin_family = AF_INET6;
addr->sin_port = conn->rport;
uip_ipaddr_copy(addr->sin_addr.s_addr, conn->ripaddr);
}
}
#else
static inline void accept_tcpsender(FAR struct uip_conn *conn,
FAR struct sockaddr_in *addr)
#endif
{
if (addr)
{
@ -114,7 +121,8 @@ static inline void accept_tcpsender(FAR struct uip_conn *conn,
uip_ipaddr_copy(addr->sin_addr.s_addr, conn->ripaddr);
}
}
#endif
#endif /* CONFIG_NET_IPv6 */
#endif /* CONFIG_NET_TCP */
/****************************************************************************
* Function: accept_interrupt
@ -304,9 +312,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
if (addr)
{
#ifdef CONFIG_NET_IPv6
if (addr->sa_family != AF_INET6 || *addrlen < sizeof(struct sockaddr_in6))
if (*addrlen < sizeof(struct sockaddr_in6))
#else
if (addr->sa_family != AF_INET || *addrlen < sizeof(struct sockaddr_in))
if (*addrlen < sizeof(struct sockaddr_in))
#endif
{
err = EBADF;

View File

@ -3551,7 +3551,7 @@ char *httpd_method_str(int method)
}
}
int httpd_get_conn(httpd_server * hs, int listen_fd, httpd_conn *hc)
int httpd_get_conn(httpd_server *hs, int listen_fd, httpd_conn *hc)
{
httpd_sockaddr sa;
socklen_t sz;
@ -3596,7 +3596,7 @@ int httpd_get_conn(httpd_server * hs, int listen_fd, httpd_conn *hc)
return GC_NO_MORE;
}
ndbg("accept: %d\n", errno);
ndbg("accept failed: %d\n", errno);
return GC_FAIL;
}