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

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2008 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-08-02 16:31:50 +00:00
parent 7c8051a574
commit 7c2070bc83
3 changed files with 21 additions and 8 deletions

7
TODO
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/) (5) Task/Scheduler (sched/)
@ -234,6 +234,11 @@ o Network (net/, netutils/)
Status: Open, depends on UDP read-ahead support Status: Open, depends on UDP read-ahead support
Priority: Medium 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) o USB (drivers/usbdev)
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/accept.c * 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> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -102,10 +102,17 @@ struct accept_s
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
static inline void accept_tcpsender(FAR struct uip_conn *conn, static inline void accept_tcpsender(FAR struct uip_conn *conn,
FAR struct sockaddr_in6 *addr) 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 #else
static inline void accept_tcpsender(FAR struct uip_conn *conn, static inline void accept_tcpsender(FAR struct uip_conn *conn,
FAR struct sockaddr_in *addr) FAR struct sockaddr_in *addr)
#endif
{ {
if (addr) 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); uip_ipaddr_copy(addr->sin_addr.s_addr, conn->ripaddr);
} }
} }
#endif #endif /* CONFIG_NET_IPv6 */
#endif /* CONFIG_NET_TCP */
/**************************************************************************** /****************************************************************************
* Function: accept_interrupt * Function: accept_interrupt
@ -304,9 +312,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
if (addr) if (addr)
{ {
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
if (addr->sa_family != AF_INET6 || *addrlen < sizeof(struct sockaddr_in6)) if (*addrlen < sizeof(struct sockaddr_in6))
#else #else
if (addr->sa_family != AF_INET || *addrlen < sizeof(struct sockaddr_in)) if (*addrlen < sizeof(struct sockaddr_in))
#endif #endif
{ {
err = EBADF; 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; httpd_sockaddr sa;
socklen_t sz; socklen_t sz;
@ -3596,7 +3596,7 @@ int httpd_get_conn(httpd_server * hs, int listen_fd, httpd_conn *hc)
return GC_NO_MORE; return GC_NO_MORE;
} }
ndbg("accept: %d\n", errno); ndbg("accept failed: %d\n", errno);
return GC_FAIL; return GC_FAIL;
} }